dcsimg
 

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Friday Feb 16th 2018 by Srinath M S

Language: Enterprise, Expertise: Intermediate - See how quickly you can send an email using the nodemailer module.

In Node.js, we can pick and choose from a lot of modules that make sending email easier. One of the most commonly used modules is "nodemailer." Check out the sample code to see how quickly you can send an email using the nodemailer module.

var nodemailer= require('nodemailer');

//create the transported object with the email id and password
var transporter = nodemailer.createTransport({
service: 'Gmail',??
auth: {
   user: ???emailaddress???,
   pass: ???password '??
}
});

//prepare the mail object
var mailContent = {??
from: ???senderEmailAddress???,??
to: ???recepeintEmailAddress???,??
subject: ???emailSubject???,??
text: ???emailBody???
};

//Send mail with the mail details
transporter.sendMail( mailContent, function(error, info)
{
   if(error)
   {
      console.log(error);
   } else 
   {
      console.log(info);
   }
}); 
Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved