Mark
0
Q:

how to send emails using nodejs

var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: '[email protected]',
    pass: 'yourpassword'
  }
});

var mailOptions = {
  from: '[email protected]',
  to: '[email protected]',
  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);
  }
});
24

  var nodemailer = require('nodemailer');

var transporter = 
  nodemailer.createTransport({
  service: 'gmail',
  auth: {
    
  user: '[email protected]',
    
  pass: 'yourpassword'
  }
});

var mailOptions = {
  
  from: '[email protected]',
  
  to: '[email protected]',
  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);
  }
}); 
0

New to Communities?

Join the community