Pra*_*lva 9 email node.js office365 nodemailer meanjs
我正在尝试使用Office365 SMTP使用Nodemailer发送电子邮件(在MEANjs脚手架中),但是我收到以下错误:
[Error: 140735277183760:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:]
Run Code Online (Sandbox Code Playgroud)
我正在使用以下Nodemailer选项:
{
host: 'smtp.office365.com',
port: '587',
auth: { user: 'xxxx', pass: 'xxxx' },
secure: 'false',
tls: { ciphers: 'SSLv3' }
}
Run Code Online (Sandbox Code Playgroud)
删除tls字段没有任何区别.我错过了什么?
Pra*_*lva 20
解决方案很简单.'secure'字段应为'secureConnection'.生成配置的MEANjs脚手架使用"安全"字段创建了邮件选项.其余选项都很好.对于需要工作Office365 SMTP节点邮件选项块的任何人,以下内容应该有效:
{
host: 'smtp.office365.com',
port: '587',
auth: { user: 'xxxx', pass: 'xxxx' },
secureConnection: false,
tls: { ciphers: 'SSLv3' }
}
Run Code Online (Sandbox Code Playgroud)
小智 15
我知道这是旧的,但如果有人在 2019 年查到这个,你可以添加
service: "Outlook365"
并且您不必指定连接选项。
let transporter = nodemailer.createTransport({
service: "Outlook365",
auth: {
user: 'FROMUSER@office365.com',
pass: 'FROMUSERPASS'
},
})
let info = transporter.sendMail({
from: 'FROMUSER@office365.com',
to: 'TOUSER@office365.com',
subject: 'Test',
text: 'hello world',
html: '<h1>TEST</h1>'
})
Run Code Online (Sandbox Code Playgroud)
这个 nodemailer 文档https://nodemailer.com/2-0-0-beta/setup-smtp/确实声明了 options.secure 而不是 options.secureConnection。在一个示例中,它还表明 options.secure 需要一个布尔值 true 或 false 而不是字符串值'true'or 'false'。''从周围删除'false'对我有用。
| 归档时间: |
|
| 查看次数: |
8082 次 |
| 最近记录: |