Infinite waiting on Node mailer module


#1

Hi Team,

I am trying to send mail using NodeMailer, but when i import Nodemailer and test the code, it goes into infinite waiting.

const nodemailer = require('nodemailer@2.5.0');
var transporter = nodemailer.createTransport({
    host: 'xx.com',
    port: 465,
    secure: true,
    auth: {
       user: 'test@xx.com',
       pass: 'xx'
    }
});

module.exports = function (event) {   

  var mailModel = {
      from: '"Test" <xx@xx.com>', // sender address
      to: 'xx@gmail.com', // list of receivers
      subject: 'Hi', // Subject line
      text: 'Foo', // plain text body
      html: '<b>Bar</b>' // html body
  };

  transporter.sendMail(mailModel, (error, info) => {
    if (error) {
      console.log(error);
    }
    console.log('Message %s sent: %s', info.messageId, info.response);
  });
  
  // console.log(event.data)
  return {data: event.data}
}

Thanks