成功 ? “已发送” :“失败”默认为“已发送”成功=空。为什么?
我正在尝试从nodeJS(使用nodemailer lib)发送电子邮件,并且我目前在整个邮件过程中遇到了一些超时。这不是我需要帮助的问题。我确实需要帮助的问题是,当它命中日志记录部分时,成功将为空,并且sole.log('Message ' +使整个console.log语句输出“已发送”。没有“消息”,没有失败 ?
知道为什么吗
nodemailer.send_mail(
// e-mail options
{
to:"[email protected]",
sender:"[email protected]",
subject:"node_mailer test email",
html:'<p><b>Hi,</b> how are you doing?</p>',
body:'Hi, how are you doing?'
},
// callback function
function(error, success){
console.log('Message ' + success ? 'sent' : 'failed');
}
);
I'm playing around with emailing from nodeJS (using the nodemailer lib), and I'm currently hitting some timeouts on the whole mailing process. That's not the problem I'd need help with. The problem I do need help with is that success will be null when it hits the logging part, and sole.log('Message ' +that makes the whole console.log statement to output "sent". No "Message", no failed.
Any idea why?
nodemailer.send_mail(
// e-mail options
{
to:"[email protected]",
sender:"[email protected]",
subject:"node_mailer test email",
html:'<p><b>Hi,</b> how are you doing?</p>',
body:'Hi, how are you doing?'
},
// callback function
function(error, success){
console.log('Message ' + success ? 'sent' : 'failed');
}
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
运算符优先级?尝试:
Operator precedence? Try:
这是您的操作优先级。
+
运算符比三元运算符具有更高的优先级,因此,您实际上在执行Which is 总是 true 的操作。相反,请执行以下操作:
It's your priority of operations. The
+
operator has higher precedence than the ternary operator, and as such, you're actually doingWhich is always true. Instead, do: