send email nodejs
snippet in javascript

send email nodejs

user5642

var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: 'youremail@gmail.com',
    pass: 'yourpassword'
  }
});

var mailOptions = {
  from: 'youremail@gmail.com',
  to: 'myfriend@yahoo.com',
  subject: 'Sending Email using Node.js',
  text: 'That was easy!'
};

transporter.sendMail(mailOptions, function(error, info){
  if (error) {
    console.log(error);
  } else {
    console.log('Email sent: ' + info.response);
  }
});

send mail node js

user6794


  var nodemailer = require('nodemailer');

var transporter = 
  nodemailer.createTransport({
  service: 'gmail',
  auth: {
    
  user: 'youremail@gmail.com',
    
  pass: 'yourpassword'
  }
});

var mailOptions = {
  
  from: 'youremail@gmail.com',
  
  to: 'myfriend@yahoo.com',
  subject: 'Sending Email using Node.js',
  text: 
  'That was easy!'
};

transporter.sendMail(mailOptions, 
  function(error, info){
  if (error) {
    console.log(error);
  } else {

     
  console.log('Email sent: ' + info.response);
  }
});