1var nodemailer = require('nodemailer');
2
3var transporter = nodemailer.createTransport({
4 service: 'gmail',
5 auth: {
6 user: 'youremail@gmail.com',
7 pass: 'yourpassword'
8 }
9});
10
11var mailOptions = {
12 from: 'youremail@gmail.com',
13 to: 'myfriend@yahoo.com',
14 subject: 'Sending Email using Node.js',
15 text: 'That was easy!'
16};
17
18transporter.sendMail(mailOptions, function(error, info){
19 if (error) {
20 console.log(error);
21 } else {
22 console.log('Email sent: ' + info.response);
23 }
24});