npm install nodemailer code example
Example 1: nodemailer
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'yourpassword'
}
});
const mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Subject of your email',
html: '<p>Your html here</p>'
};
transporter.sendMail(mailOptions, function (err, info) {
if(err)
console.log(err)
else
console.log(info);
});
Example 2: npm install nodemailer
npm i nodemailer