gpt4 book ai didi

office365 - 用于 Office 365 直接发送的 nodemailer 2.x 配置

转载 作者:行者123 更新时间:2023-12-04 16:21:11 24 4
gpt4 key购买 nike

我正在使用 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
}));

我试过指定一个 authMethodLOGINPLAIN但两者都没有任何区别。当我尝试发送电子邮件时,出现错误:
[Error: Invalid login: 504 5.7.4 Unrecognized authentication type]
code: 'EAUTH',
response: '504 5.7.4 Unrecognized authentication type',
responseCode: 504

有没有人知道 Office 365 需要什么授权类型以及我是否需要在 nodemailer 设置中指定任何不同的设置?

最佳答案

这对我有用:

    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'
}
});

您可能想添加:
    requireTLS: true

关于office365 - 用于 Office 365 直接发送的 nodemailer 2.x 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38191770/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com