英文:
Nodemailer with hostinger wrong auth
问题
对不起,我是不能提供代码的翻译。如果您有其他文字需要翻译或者有其他问题,可以随时告诉我。
英文:
I am new to the whole sending emails through websites, so apologies.
Problem:
I have a hostinger plan that has emails included. I'm using nodemailer to send the email. After a few tries I think the email will be sent if this error is solved. The config is OK, but it crashes on my auth: {}
const transporter = nodemailer.createTransport({
host: "smtp.hostinger.com",
port: 465,
secure: true,
auth: {
user: process.env.NEXT_PUBLIC_EMAIL_USERNAME,
pass: process.env.NEXT_PUBLIC_EMAIL_PASSWORD,
},
tls: {
rejectUnauthorized: false,
},
});
The Error:
Error sending email: Error: Invalid login: 535 5.7.8 Error: authentication failed:
at SMTPConnection._formatError (webpack-internal:///(sc_server)/./node_modules/nodemailer/lib/smtp-connection/index.js:611:19)
at SMTPConnection._actionAUTHComplete (webpack-internal:///(sc_server)/./node_modules/nodemailer/lib/smtp-connection/index.js:1221:34)
at SMTPConnection.eval (webpack-internal:///(sc_server)/./node_modules/nodemailer/lib/smtp-connection/index.js:427:26)
at SMTPConnection._processResponse (webpack-internal:///(sc_server)/./node_modules/nodemailer/lib/smtp-connection/index.js:748:20)
at SMTPConnection._onData (webpack-internal:///(sc_server)/./node_modules/nodemailer/lib/smtp-connection/index.js:584:14)
at TLSSocket.SMTPConnection._onSocketData (webpack-internal:///(sc_server)/./node_modules/nodemailer/lib/smtp-connection/index.js:143:48)
at TLSSocket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)
at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
code: 'EAUTH',
response: '535 5.7.8 Error: authentication failed: ',
responseCode: 535,
command: 'AUTH PLAIN'
}
In my Hostinger plan I can create emails such as "info@domain.com", when logging into that email I am sent to "hostinger.titan.email/" with an email password combination to log in. I am using THAT email password in my
user: process.env.NEXT_PUBLIC_EMAIL_USERNAME,
pass: process.env.NEXT_PUBLIC_EMAIL_PASSWORD,
If anyone has experience with this, all info would be highly appreciated
答案1
得分: 1
以下是翻译好的部分:
对于遇到此问题的任何人,Hostinger 不是主机,而是 Titan。
以下是正确的配置
let transporter = nodemailer.createTransport({
host: "smtp.titan.email",
port: 465,
secure: true,
auth: {
user: "test@domain.com",
pass: "XXXXXXX",
},
});
英文:
For anyone having this problem, Hostinger is not the host, but Titan.
Here is the correct config
let transporter = nodemailer.createTransport({
host: "smtp.titan.email",
port: 465,
secure: true,
auth: {
user: "test@domain.com",
pass: "XXXXXXX",
},
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论