fix: configuring gmail smtp relay without any authentication

This commit is contained in:
Cahit Atilgan
2025-05-13 18:07:53 +02:00
parent 8c64221f88
commit 12925c515a

View File

@@ -110,14 +110,19 @@ class EmailService {
connectionTimeout: 5000,
};
const emailConfig = systemEmailPort === "465" ? baseEmailConfig : {
const isSmtps = Number(systemEmailPort) === 465;
const emailConfig = !isSmtps ? {
...baseEmailConfig,
name: systemEmailConnectionHost,
secure: false,
pool: true,
tls: { rejectUnauthorized: false },
auth: null
};
} : baseEmailConfig;
if (!isSmtps) {
delete emailConfig.auth;
}
this.transporter = this.nodemailer.createTransport(emailConfig);