Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to authenticate outlook address via nodemailer

I am trying to authenticate an outlook email account using nodemailer. But, I continuously get the same message:

{ Error: Invalid login: 535 5.7.3 Authentication unsuccessful [CY1PR03CA0041.namprd03.prod.outlook.com] at SMTPConnection._formatError (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:591:19) at SMTPConnection._actionAUTHComplete (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:1320:34) at SMTPConnection._responseActions.push.str (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:1278:18) at SMTPConnection._processResponse (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:747:20) at SMTPConnection._onData (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:543:14) at TLSSocket._socket.on.chunk (/user_code/node_modules/nodemailer/lib/smtp-connection/index.js:694:51) at emitOne (events.js:96:13) at TLSSocket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at TLSSocket.Readable.push (_stream_readable.js:134:10) code: 'EAUTH', response: '535 5.7.3 Authentication unsuccessful [CY1PR03CA0041.namprd03.prod.outlook.com]', responseCode: 535, command: 'AUTH LOGIN' }

Here is my code for nodemailer:

const functions = require('firebase-functions');
var nodemailer=require('nodemailer')

var transporter = nodemailer.createTransport("SMTP", {
auth: {
  user: 'username',
  pass: 'password'
},
service: "hotmail"

exports.sendMail 
=functions.database.ref('requestedChats').onWrite((event)=>{
const data = {
from: '[email protected]',
to: '[email protected]',
subject: 'Hello',
text: 'Test 1235'
}
transporter.sendMail(data, (err, info)=> {
if(err)
  console.log(err)
else
  console.log(info)
})
})'
like image 777
dlucci Avatar asked Oct 17 '25 17:10

dlucci


1 Answers

I had this issue sometime. Check the outlook account, see if the mail service provider sent you an email to enable remote login.

Login attempt are rejected when you're trying to login from a new server (seems to be IP-based checking). Once you manually approve the login attempt, that server will be 'whitelisted'.

Also check for the subject (email title). It should be plain text and should not consist html code.

If you still have this issue or don't received any email from the mail service provider, this is a real issue and better off contact the mail service provider for support.

like image 121
Beeno Tung Avatar answered Oct 20 '25 07:10

Beeno Tung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!