I'm trying to use Office365 SMTP to send email using Nodemailer (in a MEANjs scaffold), but I get the following error:
我正在尝试使用Office365 SMTP使用Nodemailer发送电子邮件(在MEANjs脚手架中),但是我收到以下错误:
[Error: 140735277183760:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:]
I'm using the following Nodemailer options:
我正在使用以下Nodemailer选项:
{
host: 'smtp.office365.com',
port: '587',
auth: { user: 'xxxx', pass: 'xxxx' },
secure: 'false',
tls: { ciphers: 'SSLv3' }
}
Removing the tls field doesn't make a difference. What am I missing?
删除tls字段没有什么区别。我错过了什么?
2 个解决方案
#1
18
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:
解决方案很简单。 'secure'字段应为'secureConnection'。生成配置的MEANjs脚手架使用“安全”字段创建了邮件选项。其余选项都很好。对于需要工作Office365 SMTP节点邮件选项块的任何人,以下内容应该有效:
{
host: 'smtp.office365.com',
port: '587',
auth: { user: 'xxxx', pass: 'xxxx' },
secureConnection: false,
tls: { ciphers: 'SSLv3' }
}
#2
3
This nodemailer documentation https://nodemailer.com/2-0-0-beta/setup-smtp/ indeed states options.secure and not options.secureConnection. It also suggests, in an example, that options.secure is expecting a boolean value true or false and not a string value 'true'
or 'false'
. Removing the ''
from around 'false'
works for me.
此节点编制器文档https://nodemailer.com/2-0-0-beta/setup-smtp/确实说明options.secure而不是options.secureConnection。在一个示例中,它还建议options.secure期望布尔值为true或false,而不是字符串值'true'或'false'。从'周围'删除'''对我来说很有用。
#1
18
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:
解决方案很简单。 'secure'字段应为'secureConnection'。生成配置的MEANjs脚手架使用“安全”字段创建了邮件选项。其余选项都很好。对于需要工作Office365 SMTP节点邮件选项块的任何人,以下内容应该有效:
{
host: 'smtp.office365.com',
port: '587',
auth: { user: 'xxxx', pass: 'xxxx' },
secureConnection: false,
tls: { ciphers: 'SSLv3' }
}
#2
3
This nodemailer documentation https://nodemailer.com/2-0-0-beta/setup-smtp/ indeed states options.secure and not options.secureConnection. It also suggests, in an example, that options.secure is expecting a boolean value true or false and not a string value 'true'
or 'false'
. Removing the ''
from around 'false'
works for me.
此节点编制器文档https://nodemailer.com/2-0-0-beta/setup-smtp/确实说明options.secure而不是options.secureConnection。在一个示例中,它还建议options.secure期望布尔值为true或false,而不是字符串值'true'或'false'。从'周围'删除'''对我来说很有用。