535 5.7.139 Authentication unsuccessful

Holy Reads TEAM 1 Reputation point
2022-12-29T10:57:19.857+00:00

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)
}
});

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-12-29T16:18:41.05+00:00

    O365 is not currently supported here on Q&A. The product group for Office 365 actively monitors questions over at
    https://techcommunity.microsoft.com/t5/office-365/ct-p/Office365

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.