npm i --save nodemailer
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'yourpassword'
}
});
var mailOptions = {
from: '[email protected]',
to: '[email protected]', // others adresses here
subject: 'Sending Email using Node.js',
text: 'That was easy!'
// html : '<h1>Welcome onboard !</h1> <br> <h3>Thanks for creating your account</h3>'
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});