Hello everyone,
I migrated 2 websites (PERN Stack) from Heroku yesterday, and there is something that is broken with both of them, Nodemailer. It’s not sending mails anymore (newsletter form, contact form, account activation, password reset, …).
const transporter = nodemailer.createTransport({
service: 'hotmail',
auth: {
user: process.env.MAIL_USER,
pass: process.env.MAIL_PASS,
},
});
transporter.verify((error) => {
if (error) {
console.log(`[ERROR] - Nodemailer (${process.env.MAIL_USER}:${process.env.MAIL_PASS})`);
} else {
console.log('[SUCCESS] - Nodemailer');
}
});
I tried to verify if my secrets were the problem, but no, I get a failure in the logs with the correct credentials. [ERROR] - Nodemailer (xxx@outlook.com:xxx)
I guess the problem comes from Fly because it’s working perfectly in Heroku and when I launch both the API server and React app on my computer.
Does anyone ever encountered this problem or know where it might come from ?
[REPLY]
I reply here because i have a reply limit for my first day on the forum.
I don’t know why i didn’t think about logging the error which is the first thing I should do .
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] Error: Invalid login: 535 5.7.3 Authentication unsuccessful [FR2P281CA0012.DEUP281.PROD.OUTLOOK.COM]
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at SMTPConnection._formatError (/workspace/node_modules/nodemailer/lib/smtp-connection/index.js:787:19)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at SMTPConnection._actionAUTHComplete (/workspace/node_modules/nodemailer/lib/smtp-connection/index.js:1539:34)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at SMTPConnection.<anonymous> (/workspace/node_modules/nodemailer/lib/smtp-connection/index.js:1493:18)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at SMTPConnection._processResponse (/workspace/node_modules/nodemailer/lib/smtp-connection/index.js:950:20)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at SMTPConnection._onData (/workspace/node_modules/nodemailer/lib/smtp-connection/index.js:752:14)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at SMTPConnection._onSocketData (/workspace/node_modules/nodemailer/lib/smtp-connection/index.js:191:44)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at TLSSocket.emit (node:events:537:28)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at addChunk (node:internal/streams/readable:324:12)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at readableAddChunk (node:internal/streams/readable:297:9)
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] at Readable.push (node:internal/streams/readable:234:10) {
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] code: 'EAUTH',
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] response: '535 5.7.3 Authentication unsuccessful [FR2P281CA0012.DEUP281.PROD.OUTLOOK.COM]',
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] responseCode: 535,
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] command: 'AUTH LOGIN'
2022-08-27T15:56:18.655 app[9b2b307d] mad [info] }
Well it seems like the logins are wrong but they aren’t. The logs aren’t helping much.
I tried, just to be sure, to put plain email/pass instead of the process.env, same error.
I tried putting the config myself, same error (but it’s also working on my computer).
host: "smtp-mail.outlook.com",
secureConnection: false,
port: 587,
auth: {
user: "user@outlook.com",
pass: "password"
},
tls: {
ciphers:'SSLv3'
}