1

在服务器端(wakanda 10)我发送一封电子邮件:

var mail = require('waf-mail/mail');
var message = new mail.Mail();
message.from = 'emailadres of the sender';
message.to = [theEmailadres];
message.subject = 'Here the subject of the email';
message.setBodyAsHTML('Here the HTML content of the email');
message.send('smtp.gmail.com', 465, true, 'username', 'password');

然后看起来程序被冻结了。当我关闭调试器时,我在日志文件中收到此错误:

2016-05-11 15:17:55 [com.wakanda-software.xbox] 错误 - [1] / Broken pipe (kOTSerialOverrunErr / EPIPE).,任务 #21523,任务名称是 HTTP 连接处理程序

有人有想法吗?

4

1 回答 1

2

使用mail.send代替message.send并将domain: 'gmail.com'添加到传递给 send() 的对象:

var mail = require('waf-mail/mail'); 
var message = new mail.Mail();
message.subject = "Here the subject of the email";
message.from = "emailadres of the sender";
message.to = 'theEmailadres';
message.setBodyAsHTML("Here the HTML content of the email");
mail.send({
    address: 'smtp.gmail.com', 
    port: 465,
    isSSL: true,
    username: 'username', 
    password: 'password', 
    domain: 'gmail.com'
}, message);

它对我来说非常有效,请注意 Google 可能会阻止连接尝试,如果是这样,请在发件人 gmail 帐户的设置中启用“访问不太安全的应用程序”。允许不太安全的应用访问帐户

于 2016-05-11T15:40:52.883 回答