使用 Node JS 在网站“联系我们”页面上配置 Outlook SMTP

问题描述 投票:0回答:1

我正在尝试使用 SMTP 为客户端网站的“联系我们”页面配置 Outlook 电子邮件,但出现与身份验证相关的错误:

" [0] Error: Invalid login: 535 5.7.3 Authentication unsuccessful [MA0PR01CA0059.INDPRD01.PROD.OUTLOOK.COM 2024-04-06T09:43:31.279Z 08DC55931D44CA62]
[0] at SMTPConnection._formatError (/home/abhishek/Academy_Website/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)
[0] at SMTPConnection._actionAUTHComplete (/home/abhishek/Academy_Website/node_modules/nodemailer/lib/smtp-connection/index.js:1564:34)
[0] at SMTPConnection.<anonymous> (/home/abhishek/Academy_Website/node_modules/nodemailer/lib/smtp-connection/index.js:1518:18)
[0] at SMTPConnection._processResponse (/home/abhishek/Academy_Website/node_modules/nodemailer/lib/smtp-connection/index.js:969:20)
[0] at SMTPConnection._onData (/home/abhishek/Academy_Website/node_modules/nodemailer/lib/smtp-connection/index.js:755:14)
[0] at SMTPConnection._onSocketData (/home/abhishek/Academy_Website/node_modules/nodemailer/lib/smtp-connection/index.js:193:44)
[0] at TLSSocket.emit (node:events:513:28)
[0] at addChunk (node:internal/streams/readable:324:12)
[0] at readableAddChunk (node:internal/streams/readable:297:9)
[0] at Readable.push (node:internal/streams/readable:234:10) {
[0] code: 'EAUTH',
[0] response: '535 5.7.3 Authentication unsuccessful [MA0PR01CA0059.INDPRD01.PROD.OUTLOOK.COM 2024-04-06T09:43:31.279Z 08DC55931D44CA62]',
[0] responseCode: 535,
[0] command: 'AUTH LOGIN' "

该网站是基于nodejs构建的,这是我正在使用的控制器代码:

const transporter = nodemailer.createTransport({
host: "smtp.office365.com", // Outlook/Office 365 SMTP server
port: 587, // Port for TLS/STARTTLS
secure: false, // true for 465, false for other ports
auth: {
user: process.env.EMAIL_ADDRESS, // Your Outlook/Office 365 email address
pass: process.env.EMAIL_PASSWORD, // Your Outlook/Office 365 password
},
tls: {
ciphers: "SSLv3",
},
});

我们似乎陷入了这一点。关于如何推进这件事有什么建议吗?

在线搜索似乎表明这是为了使用“Microsoft Entra”管理员登录来更改组织的安全默认值,但我找不到专门为此用户禁用它们并为所有人保留完整的选项其他用户。

smtp office365
1个回答
0
投票

Office 365 不再允许使用 SMTP 进行基本身份验证,您需要使用 OAuth。

© www.soinside.com 2019 - 2024. All rights reserved.