node smtp mail code example
Example: nodemailer
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'yourpassword'
}
});
const mailOptions = {
from: '[email protected]', // sender address
to: '[email protected]', // list of receivers
subject: 'Subject of your email', // Subject line
html: '<p>Your html here</p>'// plain text body
};
transporter.sendMail(mailOptions, function (err, info) {
if(err)
console.log(err)
else
console.log(info);
});