如何使用Nodemailer发送电子邮件与Hostinger专业电子邮件?

huangapple go评论69阅读模式
英文:

How to send email using nodemailer with hostinger professional email?

问题

我正在尝试使用nodemailer发送电子邮件。电子邮件托管在hostinger上。
这是我的配置:

host: "smtp.hostinger.com",
port: 465,
secure: true,
auth: {
    user: process.env.GRIEVANCE_EMAIL,
    pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
},

但每次我都遇到这个错误:
发送电子邮件时发生错误:无效的登录:535 5.7.8 错误:身份验证失败:

用户名和密码是正确的,因为我使用相同的凭据登录hostinger webmail。我尝试设置secure: false,添加tls: {rejectUnauthorized: false},但都没有起作用。我必须在2天内部署该项目,即使ChatGPT也无法帮助我。

英文:

I am trying to send emails using nodemailer. Email is hosted on hostinger.
Here is my configuration:

host: "smtp.hostinger.com",
port: 465,
secure: true,
auth: {
    user: process.env.GRIEVANCE_EMAIL,
    pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
},

But every time I encounter this error:
Error occurred while sending the email: Invalid login: 535 5.7.8 Error: authentication failed:

user and pass is correct as i log into hostinger webmail with the same credentials. I tried setting secure: false, adding tls: {rejectUnauthorized: false} but nothing works. I have to deploy the project in 2 days, event ChatGPT can't help me.

答案1

得分: 1

问题已使用以下配置解决:

host: "smpt.hostinger.com",
secure: true, 
secureConnection: false,
tls: {
   ciphers: "SSLv3",
},
requireTLS: true,
port: 465,
debug: true,
connectionTimeout: 10000,
auth: {
    user: process.env.GRIEVANCE_EMAIL,
    pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
},
英文:

The problem got solved using this configuration:

host: "smpt.hostinger.com",
secure: true, 
secureConnection: false,
tls: {
   ciphers: "SSLv3",
},
requireTLS: true,
port: 465,
debug: true,
connectionTimeout: 10000,
auth: {
    user: process.env.GRIEVANCE_EMAIL,
    pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
},

答案2

得分: 0

你的配置只缺少正确的主机名。Hostinger使用的是titan而不是自己托管webmail。应该看起来像下面这样:

host: "smtp.titan.email",
port: 465,
secure: true,
auth: {
    user: process.env.GRIEVANCE_EMAIL,
    pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
},
英文:

Your configuration is only missing the correct host name. Hostinger uses titan rather than hosting webmails itself. Should look like the following:

host: "smtp.titan.email",
port: 465,
secure: true,
auth: {
    user: process.env.GRIEVANCE_EMAIL,
    pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
},

huangapple
  • 本文由 发表于 2023年6月22日 20:42:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76532037.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定