Email 无法使用Wakanda服务器1.1.3发送电子邮件
当我尝试使用以下代码通过Wakanda服务器发送电子邮件时,会发生错误:Email 无法使用Wakanda服务器1.1.3发送电子邮件,email,server,wakanda,Email,Server,Wakanda,当我尝试使用以下代码通过Wakanda服务器发送电子邮件时,会发生错误: var mail = require('waf-mail/mail'); var message = new mail.Mail(); message.subject = "Here the subject of the email"; message.from = "me@mydomain.com"; message.to = 'user@somedomain.com'; message.setBody("This is
var mail = require('waf-mail/mail');
var message = new mail.Mail();
message.subject = "Here the subject of the email";
message.from = "me@mydomain.com";
message.to = 'user@somedomain.com';
message.setBody("This is a test message");
mail.send({
address: 'mail.mydomain.com',
port: 587,
isSSL: true,
username: 'MY-USERNAME',
password: 'MY-PASSWORD',
domain: 'mydomain.com'
}, message);
在调试模式下运行时,在mail.send
期间,以下行出现错误:
socket = tls.connect(port, address, connectCallback);
调试时,我无法单步执行此函数调用,并且在尝试执行此操作时出错
文档说,mail.send
应该返回一个status对象,但这里没有。将try/catch添加到mail.send
调用会在catch中生成此错误对象:
Error = {
error: [{
componentSignature: "xbox"
errCode: 5
message: ""}],
messages: [""]
}
Wakanda服务器1.1.3
MacOS 10.11.6
我不是在使用gmail发送电子邮件。确保您在mail.send属性中有正确的地址和端口。 您必须为正在使用的邮件搜索正确的smtp设置。 对于gmail,我成功地通过以下方式发送电子邮件:
var mail = require('waf-mail/mail');
var message = new mail.Mail();
message.subject = "Test";
message.from = "me@gmail.com";
message.to = ['me@gmail.com' , 'user@wakanda.io'];
message.setBody("This is a test message");
mail.send({
address: 'smtp.gmail.com',
port: 465,
isSSL: true,
username: 'username',
password: 'password',
domain: 'gmail.com'
}, message);
结果是密码的最后一个字符丢失了。我不知道这是怎么发生的。即便如此,waf邮件仍应返回action属性值为3(身份验证失败)的status对象,而不是引发无法理解的异常。