fix: #10614 - made nodemailer compatible with mailhog smtp server. (#10615)

* mailhog server auth problem solved

* put condition on transport auth

* fixe type-check error
pull/10655/head^2
Rohit Saini 2023-08-10 22:49:21 +05:30 committed by GitHub
parent 57384eb921
commit a3aa53fe6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -10,13 +10,18 @@ function detectTransport(): SendmailTransport.Options | SMTPConnection.Options |
if (process.env.EMAIL_SERVER_HOST) {
const port = parseInt(process.env.EMAIL_SERVER_PORT || "");
const auth =
process.env.EMAIL_SERVER_USER && process.env.EMAIL_SERVER_PASSWORD
? {
user: process.env.EMAIL_SERVER_USER,
pass: process.env.EMAIL_SERVER_PASSWORD,
}
: undefined;
const transport = {
host: process.env.EMAIL_SERVER_HOST,
port,
auth: {
user: process.env.EMAIL_SERVER_USER,
pass: process.env.EMAIL_SERVER_PASSWORD,
},
auth,
secure: port === 465,
tls: {
rejectUnauthorized: !isENVDev,