/*
Nodemailer is a module for Node.js applications to allow easy as cake email sending. The project got started back in 2010 when there was no sane option to send email messages
*/
const nodemailer = require(‘nodemailer’);
/*
SMTP is the main transport in Nodemailer for delivering messages. SMTP is also the protocol used between different email hosts, so its truly universal. Almost every email delivery provider supports SMTP based sending
*/
var smtpTransport = require(‘nodemailer-smtp-transport’);
var transporter = nodemailer.createTransport(smtpTransport ({
tls: {
},
host: ‘’,
secureConnection: false,
port: 587,
auth: {
user: ‘’,
pass: ‘’
}
}));
var mailOptions = {
from: ‘’,
to: ‘’,
subject: ‘This is a test ‘,
text: ‘Hello this testing message’
};
transporter.sendMail(mailOptions, function(error, info){
console.log(“error,info”,error, info);
});
put in tls option rejectUnauthorized: false
/*
rejectUnauthorized: If true, the server certificate is verified against the list of supplied CAs. An error event is emitted if verification fails; err.code contains the OpenSSL error code. Default: true.
*/
Top comments (1)
hello! 4 years later, getting use out of your post. THANK YOU!
I'm having trouble with the "host" property. I'm trying to send emails from a WebMail address. What should I be putting as the value for "host"??
Thank you!