smtp: add debug option

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-05-30 19:11:28 +02:00
parent a2fc7d3cc5
commit 8339fee69d
10 changed files with 101 additions and 17 deletions

View File

@@ -275,6 +275,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</div>
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="idSMTPDebug" name="smtp_debug"
{{if gt .Configs.SMTP.Debug 0}}checked{{end}}>
<label for="idSMTPDebug" class="form-check-label">Debug logs</label>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="input-group">
@@ -352,6 +360,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
$('#smtpTestResultModal').modal('show');
return;
}
let debug = 0;
if ($('#idSMTPDebug').is(':checked')){
debug = 1;
}
$('#smtpSuccessMsg').hide();
$('#smtpErrorMsg').hide();
showSpinner();
@@ -360,7 +372,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
url: "{{.ConfigsURL}}/smtp/test",
type: 'POST',
headers: {'X-CSRF-TOKEN' : '{{.CSRFToken}}'},
data: JSON.stringify({"host": $('#idSMTPHost').val(),"port": parseInt($('#idSMTPPort').val()),"from": $('#idSMTPFrom').val(),"user": $('#idSMTPUsername').val(),"password": $('#idSMTPPassword').val(),"auth_type": parseInt($('#idSMTPAuth').val()),"encryption": parseInt($('#idSMTPEncryption').val()), "domain": $('#idSMTPDomain').val(),"recipient": recipient}),
data: JSON.stringify({"host": $('#idSMTPHost').val(),"port": parseInt($('#idSMTPPort').val()),"from": $('#idSMTPFrom').val(),"user": $('#idSMTPUsername').val(),"password": $('#idSMTPPassword').val(),"auth_type": parseInt($('#idSMTPAuth').val()),"encryption": parseInt($('#idSMTPEncryption').val()), "domain": $('#idSMTPDomain').val(),"debug": debug, "recipient": recipient}),
dataType: 'json',
contentType: 'application/json; charset=utf-8',
timeout: 15000,