I'm trying to send email via nodemailer. And sender email is of microsoft azure. But I'm getting error-response: '535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. MFA is enabled. Also I have generated app password. Can anyone please help me with this issue. Code snippet to send mail-
var userTransporter = nodemailer.createTransport({
host: 'smtp.office365.com',
port: 587, // secure SMTP
secure: false,
auth: {
user:SENDER_EMAIL,
pass: SENDER_APP_PASSWORD,
}
});
var mailOptions = {
from: SENDER_EMAIL,
to: email,
template: path.join(__dirname, "../public/views/email-verification"),
context: {
token: otp,
email: email,
url: EMAIL_VERIFICATION_LINK,
name: user_name
},
};
let mail = await transporter.sendMail(mailOptions);