使用nodemailer通过Office365 smtp发送电子邮件时出错(MEANjs scaffold)
我试图使用Office365 SMTP发送电子邮件使用Nodemailer(在MEANjs脚手架),但我得到以下错误:
[Error: 140735277183760:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:]
我正在使用以下的Nodemailer选项:
{ host: 'smtp.office365.com', port: '587', auth: { user: 'xxxx', pass: 'xxxx' }, secure: 'false', tls: { ciphers: 'SSLv3' } }
删除tls字段并没有什么区别。 我错过了什么?
解决scheme很简单。 'secure'字段应该是'secureConnection'。 生成configuration的MEANjs脚手架使用“安全”字段创build邮件选项。 其余的选项都很好。 对于任何需要工作的Office365 SMTP节点选项块的用户,以下内容应该可以工作:
{ host: 'smtp.office365.com', port: '587', auth: { user: 'xxxx', pass: 'xxxx' }, secureConnection: false, tls: { ciphers: 'SSLv3' } }
这个nodemailer文档https://nodemailer.com/2-0-0-beta/setup-smtp/确实声明了options.secure而不是options.secureConnection。 这也表明,在一个例子中,options.secure期望布尔值为true或false,而不是string值'true'
或'false'
。 从'false'
周围删除''
为我工作。