fix: add option to disable STARTTLS for SMTP servers without TLS support

Fixes #6018 - adds a 'Disable STARTTLS' checkbox that lets users connect to legacy SMTP servers that don't support encryption
This commit is contained in:
Dharun Ashokkumar 2026-01-19 23:45:54 +05:30
parent f8652c27af
commit 38c6586521
3 changed files with 37 additions and 3 deletions

View File

@ -14,11 +14,25 @@ class SMTP extends NotificationProvider {
host: notification.smtpHost, host: notification.smtpHost,
port: notification.smtpPort, port: notification.smtpPort,
secure: notification.smtpSecure, secure: notification.smtpSecure,
tls: {
rejectUnauthorized: !notification.smtpIgnoreTLSError || false,
},
}; };
// Handle TLS/STARTTLS options
if (notification.smtpSecure) {
// SMTPS (implicit TLS on port 465)
config.tls = {
rejectUnauthorized: !notification.smtpIgnoreTLSError || false,
};
} else if (notification.smtpIgnoreSTARTTLS) {
// Disable STARTTLS completely for servers that don't support it
// Connection will remain unencrypted
config.ignoreTLS = true;
} else {
// Allow STARTTLS (default behavior for ports 25, 587)
config.tls = {
rejectUnauthorized: !notification.smtpIgnoreTLSError || false,
};
}
// Fix #1129 // Fix #1129
if (notification.smtpDkimDomain) { if (notification.smtpDkimDomain) {
config.dkim = { config.dkim = {

View File

@ -56,6 +56,24 @@
</div> </div>
</div> </div>
<div v-if="!$parent.notification.smtpSecure" class="mb-3">
<div class="form-check">
<input
id="ignore-starttls"
v-model="$parent.notification.smtpIgnoreSTARTTLS"
class="form-check-input"
type="checkbox"
value=""
/>
<label class="form-check-label" for="ignore-starttls">
{{ $t("Disable STARTTLS") }}
</label>
</div>
<div class="form-text">
{{ $t("disableSTARTTLSDescription") }}
</div>
</div>
<div class="mb-3"> <div class="mb-3">
<label for="username" class="form-label">{{ $t("Username") }}</label> <label for="username" class="form-label">{{ $t("Username") }}</label>
<input <input

View File

@ -585,6 +585,8 @@
"secureOptionNone": "None / STARTTLS (25, 587)", "secureOptionNone": "None / STARTTLS (25, 587)",
"secureOptionTLS": "TLS (465)", "secureOptionTLS": "TLS (465)",
"Ignore TLS Error": "Ignore TLS Error", "Ignore TLS Error": "Ignore TLS Error",
"Disable STARTTLS": "Disable STARTTLS",
"disableSTARTTLSDescription": "Enable this option for SMTP servers that do not support STARTTLS. This will send emails over an unencrypted connection.",
"From Email": "From Email", "From Email": "From Email",
"emailCustomisableContent": "Customisable content", "emailCustomisableContent": "Customisable content",
"smtpLiquidIntroduction": "The following two fields are templatable via the Liquid templating Language. Please refer to the {0} for usage instructions. These are the available variables:", "smtpLiquidIntroduction": "The following two fields are templatable via the Liquid templating Language. Please refer to the {0} for usage instructions. These are the available variables:",