add STMP_SECURE and changed auth config (#81)

* add STMP_SECURE and changed auth config
* relocated logic to mail.provider.ts
This commit is contained in:
olivierIllogika
2024-07-19 07:54:55 -04:00
committed by GitHub
parent a2ae341934
commit 227ac30d5e
2 changed files with 16 additions and 4 deletions

View File

@ -26,16 +26,21 @@ export const mailDriverConfigProvider = {
switch (driver) {
case MailOption.SMTP:
let auth = undefined;
if (environmentService.getSmtpUsername() && environmentService.getSmtpPassword()) {
auth = {
user: environmentService.getSmtpUsername(),
pass: environmentService.getSmtpPassword(),
};
}
return {
driver,
config: {
host: environmentService.getSmtpHost(),
port: environmentService.getSmtpPort(),
connectionTimeout: 30 * 1000, // 30 seconds
auth: {
user: environmentService.getSmtpUsername(),
pass: environmentService.getSmtpPassword(),
},
auth,
secure: environmentService.getSmtpSecure(),
} as SMTPTransport.Options,
};