I've used smtp office365 for sent email using nodejs transporter method, i'm unable to sent email and continues getting same error
tried with enbled disbled security defaults but same error showd me
tried with app password but show sames error
Error: 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [PN2PR01CA0188.INDPRD01.PROD.OUTLOOK.COM]
See my code is look like below
const credentials = {
host: 'smtp.office365.com',
port: 587,
auth: {
user: config.SMTP_EMAIL,
pass: config.SMTP_SECRET
},
secure: false,
tls: {
rejectUnauthorized: false,
},
};
const transporter = nodemailer.createTransport(credentials);
const mailOptions: any = {
from: config.SMTP_EMAIL,
to: receiverEmail,
subject,
headers: {
"X-Laziness-level": 1000,
"charset": 'UTF-8'
},
html,
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.log(error.message)
reject(false)
} else {
resolve(true)
}
});