fix: add option to disable STARTTLS for SMTP servers without TLS support (#6770)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Dharun Ashokkumar
2026-01-19 23:32:06 +00:00
committed by GitHub
co-authored by autofix-ci[bot] Frank Elsinga
parent f8d494a03d
commit b638ae48ef
3 changed files with 38 additions and 3 deletions
+18 -3
View File
@@ -1,5 +1,6 @@
const nodemailer = require("nodemailer");
const NotificationProvider = require("./notification-provider");
const { log } = require("../../src/util");
class SMTP extends NotificationProvider {
name = "smtp";
@@ -14,11 +15,25 @@ class SMTP extends NotificationProvider {
host: notification.smtpHost,
port: notification.smtpPort,
secure: notification.smtpSecure,
tls: {
rejectUnauthorized: !notification.smtpIgnoreTLSError || false,
},
};
// Handle TLS/STARTTLS options
if (!notification.smtpSecure && notification.smtpIgnoreSTARTTLS) {
// Disable STARTTLS completely for servers that don't support it
// Connection will remain unencrypted
log.warn(
"notification",
`SMTP notification using unencrypted connection (STARTTLS disabled) to ${notification.smtpHost}:${notification.smtpPort}`
);
config.ignoreTLS = true;
} else {
// SMTPS (implicit TLS on port 465)
// or STARTTLS (default behavior for ports 25, 587)
config.tls = {
rejectUnauthorized: !notification.smtpIgnoreTLSError || false,
};
}
// Fix #1129
if (notification.smtpDkimDomain) {
config.dkim = {