Sending mails in nodeJS
The npm provides a pretty package to send the emails
1. Using nodemailer
- The Nodemailer module makes it easy to send emails from the nodejs application
- Install using the command, npm install nodemailer
var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'test@test.com', pass: 'password' } }); var config = { from: 'test@test.com', to: 'test2@test.com', subject: 'Test mail from sendmailer', text: 'Hello world!' }; transporter.sendMail(config, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent'); } });