Reputation: 622
I'm trying to send the mail using nodemailer without signing(without providing credential).
const nodemailer = require('nodemailer');
const smtpConfig = {
host: 'Smtp.gmail.com',
port: 587, //I've tried other port also. But nothing works.
secure: false, // dont use SSL
tls: {rejectUnauthorized: false} ,
use_authentication: false,
};
const transporter = nodemailer.createTransport(smtpConfig);
const mailOptions = {
from: "[email protected]",
to: "[email protected]",
subject: 'Hello ✔', // Subject line
text: 'Hello world ', // plaintext body
html: '<b>Hello world </b>' // html body
};
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log("we got an error",error);
}
console.log('Message sent: ' + info.response);
});
But this gives an error Error: Mail command failed: 530-5.7.0 Authentication Required.
Upvotes: 0
Views: 400
Reputation: 169
Gmail needs authentication. The issue is not located in nodemailer ;)
Upvotes: 1