Nodemailer,当我收到来自的电子邮件时是不正确的?

时间:2015-02-08 02:34:09

标签: javascript node.js email nodemailer

我认为这工作正常,直到我意识到当我在gmail中收到邮件时,发件人(来自)是myemail@gmail.com?它应该来自req.body.email对吗?

router.post('/send_message', function(req,res) {

  // create reusable transporter object using SMTP transport 
  var transporter = nodemailer.createTransport({
    service: 'Gmail',
    auth: {
      user: 'myemail@gmail.com',
      pass: 'pass'
    }
  });

  transporter.sendMail({
      from: req.body.email,
      to: 'myemail@gmail.com',
      subject: req.body.subject,
      text: req.body.message
  }, function(err, info) {

    res.send('Emailed successfully');

  });

});

0 个答案:

没有答案