node.js发送电子邮件成功,但找不到邮件

时间:2011-10-13 07:08:31

标签: email node.js

我正在使用https://github.com/eleith/emailjs作为我的node.js应用程序 正确设置配置后,当我发送电子邮件时,我在日志中收到了成功的消息,但我在收件箱或spambox中看不到任何邮件:-( .. 我使用gmail,smtp.gmail.com,ssl:true,port:465。

email.send({...},function(err, message) { 
        if (err) {
            console.log('Error sending email : ', err);
        } 
        else {
            console.log('Email SUCCESSFULLY sent', message);
        }

^[[32m[2011-10-13 06:53:28.758] [INFO] console - ^[[39mEmail SUCCESSFULLY sent {
 attachments: [],
  html: null,
  header:
   { 'message-id': '<1318488805460.5532@Abcd-PC>',
     from: 'xxxxx@gmail.com',
     to: 'yyyyy@gmail.com, ',
     cc: 'zzzzz@gmail.com',
     subject: 'Test mail from emailjs' },
  content: 'text/plain; charset=utf-8',
  text: 'Testing sending email' }

2 个答案:

答案 0 :(得分:0)

我在node.js中使用以下代码发送电子邮件(使用emailjs

var server  = email.server.connect({
  user: 'your@gmail.com',
  password: 'gmailPass',
  host: 'smtp.gmail.com',
  ssl: true
});

server.send({
  text: 'hello world',
  from: 'obama@state.gov',
  to: 'someone@else.com',
  subject: 'just a subject here'
}, function(err, message) {
  if (err) {
    // err
  } else {
    // ok
  }
});

答案 1 :(得分:0)

问题是'to'电子邮件中的逗号(“yyyyy@gmail.com”。我试图添加多个用逗号(,)分隔的ID,这就产生了问题..

在文档中,他们提到了

**"someone <someone@gmail.com>, another <another@gmail.com>"**
may be it expects the email format to be in the form they mentioned.
相关问题