在服务器端(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] /断管道(kOTSerialOverrunErr / EPIPE)。,任务#21523,任务名称是HTTP连接处理程序
有人有想法吗?
答案 0 :(得分:2)
使用 mail.send 取消 message.send ,并将域名:' 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帐户的设置中。 Allow less secure apps to access accounts