diff --git a/backend/src/modules/mail/mail.service.ts b/backend/src/modules/mail/mail.service.ts index 0c2be27..2d96a6e 100644 --- a/backend/src/modules/mail/mail.service.ts +++ b/backend/src/modules/mail/mail.service.ts @@ -69,21 +69,17 @@ export class MailService { const smtpUser = this.configService.get('smtp_user'); const smtpPassword = this.configService.get('smtp_password'); - const transportConfig: SMTPTransport.Options = { + const transportConfig = { host: smtpHost, port: smtpPort, secure: smtpSecure, pool: true, maxConnections: 1, maxMessages: 100, - }; - - if (smtpAuthRequired && smtpUser && smtpPassword) { - transportConfig.auth = { - user: smtpUser, - pass: smtpPassword, - }; - } + ...(smtpAuthRequired && smtpUser && smtpPassword + ? { auth: { user: smtpUser, pass: smtpPassword } } + : {}), + } as SMTPTransport.Options; return transportConfig; }