I am trying to send mail in node.js using Nodemailer but it shows some error like
{ [Error: self signed certificate in certificate chain] code: 'ECONNECTION', command: 'CONN' }
My node.js code is
var express = require('express');
var app = express();
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport('smtps://something%40gmail.com:[email protected]');
var mailOptions = {
to: '[email protected]',
subject: 'Hello ?',
text: 'Hello world ??',
html: '<b>Hello world ??</b>'
};
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log(error);
}
console.log('Message sent: ' + info.response);
});
var server = app.listen(8900,function(){
console.log("We have started our server on port 8900");
});
try https://github.com/nodemailer/nodemailer/issues/406
add tls: { rejectUnauthorized: false }
to your transporter constructor options
p.s It's not a good idea to post your mail server address, if it's a real one