After checking similar posts online, still couldn't figure out the issue. I am trying to send email through nodemailer by using my outlook business email. I am getting this error message that I couldn't fix.
Here is error message:
Error: Invalid login: 451 4.7.0 Temporary server error. Please try again later. PRX4 [BY3PR10CA0026.namprd10.prod.outlook.com]
at SMTPConnection._formatError (/Users/zhongzechen/Hello--website--backend/node_modules/nodemailer/lib/smtp-connection/index.js:774:19)
at SMTPConnection._actionAUTHComplete (/Users/zhongzechen/Hello--website--backend/node_modules/nodemailer/lib/smtp-connection/index.js:1518:34)
at SMTPConnection.<anonymous> (/Users/zhongzechen/Hello--website--backend/node_modules/nodemailer/lib/smtp-connection/index.js:1476:18)
at SMTPConnection._processResponse (/Users/zhongzechen/Hello--website--backend/node_modules/nodemailer/lib/smtp-connection/index.js:937:20)
at SMTPConnection._onData (/Users/zhongzechen/Hello--website--backend/node_modules/nodemailer/lib/smtp-connection/index.js:739:14)
at TLSSocket.SMTPConnection._onSocketData (/Users/zhongzechen/Hello--website--backend/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
Tried adding tls to { ciphers: 'SSLv3' }, didn;t work out.
Here is part of my code:
const output = `<h3>Hello</h3>`;
let transporter = nodemailer.createTransport({
host: "smtp-mail.outlook.com",
secure: false,
port: 587,
auth:{
user:"myoutlookemail",
pass:"mypassword"
}
})
let mailOptions ={
from:'myoutlookemail',
to:req.body.email,
subject:"Hello there",
text:"Hello there",
html:output
}
transporter.sendMail(mailOptions,(error,info)=>{
if(error){
console.log('*********ERROR IS HAPPENING*************')
return console.log(error);
}
console.log('Message Sent~~~~~~~~~~~~~~~: %s',info.response);
//console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
});