fix: configuring gmail smtp relay without any authentication

This commit is contained in:
Cahit Atilgan committed 2025-05-13 16:21:30 +02:00
1 parent 6eac73218d
commit 8c64221f88
2 files changed
+12 -1

No files matched your search

+11 -1
View File
@@ -96,9 +96,10 @@ class EmailService {
systemEmailUser, systemEmailUser,
systemEmailAddress, systemEmailAddress,
systemEmailPassword, systemEmailPassword,
systemEmailConnectionHost
} = await this.settingsService.getDBSettings(); } = await this.settingsService.getDBSettings();
const emailConfig = { const baseEmailConfig = {
host: systemEmailHost, host: systemEmailHost,
port: systemEmailPort, port: systemEmailPort,
secure: true, secure: true,
@@ -109,6 +110,15 @@ class EmailService {
connectionTimeout: 5000, connectionTimeout: 5000,
}; };
const emailConfig = systemEmailPort === "465" ? baseEmailConfig : {
...baseEmailConfig,
name: systemEmailConnectionHost,
secure: false,
pool: true,
tls: { rejectUnauthorized: false },
auth: null
};
this.transporter = this.nodemailer.createTransport(emailConfig); this.transporter = this.nodemailer.createTransport(emailConfig);
const buildHtml = async (template, context) => { const buildHtml = async (template, context) => {
+1
View File
@@ -7,6 +7,7 @@ const envConfig = {
systemEmailUser: process.env.SYSTEM_EMAIL_USER, systemEmailUser: process.env.SYSTEM_EMAIL_USER,
systemEmailAddress: process.env.SYSTEM_EMAIL_ADDRESS, systemEmailAddress: process.env.SYSTEM_EMAIL_ADDRESS,
systemEmailPassword: process.env.SYSTEM_EMAIL_PASSWORD, systemEmailPassword: process.env.SYSTEM_EMAIL_PASSWORD,
systemEmailConnectionHost: process.env.SYSTEM_EMAIL_CONNECTION_HOST,
jwtSecret: process.env.JWT_SECRET, jwtSecret: process.env.JWT_SECRET,
jwtTTL: process.env.TOKEN_TTL, jwtTTL: process.env.TOKEN_TTL,
clientHost: process.env.CLIENT_HOST, clientHost: process.env.CLIENT_HOST,