gpt4 book ai didi

javascript - 535使用nodemailer的错误身份验证错误

转载 作者:行者123 更新时间:2023-12-04 00:23:10 26 4
gpt4 key购买 nike

Nodemailer正在使用这些设置在localhost上运行并发送电子邮件,但这些在实时服务器上不起作用。为什么会这样?它总是会引发错误的授权错误。我尝试了许多解决方案,但仍然遇到这个问题。我在哪里做错了?有人能弄清楚吗?

错误:

{ Error: Invalid login: 535 Incorrect authentication data
at SMTPConnection._formatError (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/home/testing_node/public_html/testing_node/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at TLSSocket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at TLSSocket.Readable.push (_stream_readable.js:219:10)
at TLSWrap.onread (net.js:635:20)
code: 'EAUTH',
response: '535 Incorrect authentication data',
responseCode: 535,
command: 'AUTH PLAIN' }



我的代码:

exports.sendNodeMail = function (email) {
var transporter = nodemailer.createTransport({
name: 'www.domain.com',
host: 'box****.bluehost.com',
port: 465,
secure: false,
auth: {
user: 'noreply@domain.com',
pass: 'password'
},
tls: {
rejectUnauthorized: false
}

});

const mailOptions = {
from: 'noreply@domain.com',
to: email,
subject: 'Hello',
html: 'Hello World'
};
return transporter.sendMail(mailOptions, function (err, info) {
if (err)
console.log(err);
else
console.log(info);
});
};

最佳答案

您应该将465端口的安全字段设置为true,而将所有其他端口的安全字段设置为false。另外,您的姓名和主持人应为“ mail.someDomaine.com”,但您可以与电子邮件提供商确认。

另外,请确保用户和密码正确。

关于javascript - 535使用nodemailer的错误身份验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59723690/

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