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: "my-address@gmail.com",
to: "reciever-address@gmail.com",
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.
Gmail needs authentication. The issue is not located in nodemailer ;)