I was using my gmail account to send an smtp alert messages to my users email . Example, registration or account blocked etc. I am using a nodemailer and was email were sent
I have faced the same error, this worked for me
try {
var transporter = nodemailer.createTransport({
service: 'gmail',
port:465,
secure: true, // true for 465, false for other ports
logger: true,
debug: true,
secureConnection: false,
auth: {
user: 'test@gmail.com', // generated ethereal user
pass: '*****', // generated ethereal password
},
tls:{
rejectUnAuthorized:true
}
})
var info = await transporter.sendMail({
from: 'myuser@outlook.com', // sender address
to: 'anotheruser@hotmail.co.uk', // list of receivers
subject: 'Test Email', // Subject line
text: 'Hello world ?' // plain text body
html: output, // html body
});
}
catch(error) {
console.log(error)
}