Dav*_*son 5 office365 nodemailer
我正在使用nodemailer v2.4.2和node.js v4.4.7,我想通过我的Office 365 SMTP邮件服务器从我的服务器发送电子邮件.我正在使用带有此配置的smtpTransport v2.5.0:
var transporter = nodemailer.createTransport(smtpTransport({
host: 'smtp.office365.com',
port: 25, // have tried 465
secureConnection: secure,
auth: {
user: username,
pass: password
},
tls: {
rejectUnauthorized: false // don't verify certificates
},
ignoreTLS: false // don't turn off STARTTLS support
}));
Run Code Online (Sandbox Code Playgroud)
我已经试过指定authMethod的LOGIN和PLAIN,但没有任何区别.当我尝试发送电子邮件时出现错误:
[Error: Invalid login: 504 5.7.4 Unrecognized authentication type]
code: 'EAUTH',
response: '504 5.7.4 Unrecognized authentication type',
responseCode: 504
Run Code Online (Sandbox Code Playgroud)
有没有人知道Office 365预期的授权类型以及我是否需要在nodemailer设置中指定任何不同的设置?
Jul*_*inn 21
这对我有用:
var transporter = nodemailer.createTransport({
host: 'smtp.office365.com', // Office 365 server
port: 587, // secure SMTP
secure: false, // false for TLS - as a boolean not string - but the default is false so just remove this completely
auth: {
user: username,
pass: password
},
tls: {
ciphers: 'SSLv3'
}
});
Run Code Online (Sandbox Code Playgroud)
您可以添加:
requireTLS: true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9490 次 |
| 最近记录: |