使用nodemailer通过Office365

使用nodemailer通过Office365

本文介绍了使用nodemailer通过Office365 smtp(MEANjs支架)发送电子邮件时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Office365 SMTP发送电子邮件使用Nodemailer(在MEANjs支架),但我收到以下错误:

I'm trying to use Office365 SMTP to send email using Nodemailer (in a MEANjs scaffold), but I get the following error:

[Error: 140735277183760:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:]

我使用以下Nodemailer选项:

I'm using the following Nodemailer options:

{
    host: 'smtp.office365.com',
    port: '587',
    auth: { user: 'xxxx', pass: 'xxxx' },
    secure: 'false',
    tls: { ciphers: 'SSLv3' }
}

删除 tls 字段没有什么区别。我缺少什么?

Removing the tls field doesn't make a difference. What am I missing?

推荐答案

解决方案很简单。 'secure'字段应该是'secureConnection'。生成配置的MEANjs脚手架使用'secure'字段创建了邮件程序选项。其余的选项是罚款。对于需要工作的Office 365 SMTP nodemailer选项块的任何人,以下应该可以工作:

The solution was simple. The 'secure' field should be 'secureConnection'. The MEANjs scaffold that generated the configs created mailer options with the 'secure' field. The rest of the options are fine. For anyone that needs a working Office365 SMTP nodemailer options block, the following should work:

{
    host: 'smtp.office365.com',
    port: '587',
    auth: { user: 'xxxx', pass: 'xxxx' },
    secureConnection: false,
    tls: { ciphers: 'SSLv3' }
}

这篇关于使用nodemailer通过Office365 smtp(MEANjs支架)发送电子邮件时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 19:01