diff --git a/server/src/service/infrastructure/emailService.ts b/server/src/service/infrastructure/emailService.ts index 4428b0477..137bd9e2b 100755 --- a/server/src/service/infrastructure/emailService.ts +++ b/server/src/service/infrastructure/emailService.ts @@ -127,6 +127,9 @@ export class EmailService implements IEmailService { systemEmailRejectUnauthorized, } = config; + const trimmedDisplayName = systemEmailDisplayName?.trim(); + const from = trimmedDisplayName && systemEmailAddress ? { name: trimmedDisplayName, address: systemEmailAddress } : systemEmailAddress; + const emailConfig = { host: systemEmailHost, port: Number(systemEmailPort), @@ -138,6 +141,7 @@ export class EmailService implements IEmailService { name: systemEmailConnectionHost || "localhost", connectionTimeout: 5000, pool: systemEmailPool, + from, tls: { rejectUnauthorized: systemEmailRejectUnauthorized, ignoreTLS: systemEmailIgnoreTLS, @@ -159,13 +163,9 @@ export class EmailService implements IEmailService { return false; } - const trimmedDisplayName = systemEmailDisplayName?.trim(); - const from = trimmedDisplayName && systemEmailAddress ? { name: trimmedDisplayName, address: systemEmailAddress } : systemEmailAddress; - try { const info = await this.transporter.sendMail({ to: to, - from: from, subject: subject, html: html, });