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

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

How to send email using nodemailer with hostinger professional email?

问题

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

  1. host: "smtp.hostinger.com",
  2. port: 465,
  3. secure: true,
  4. auth: {
  5. user: process.env.GRIEVANCE_EMAIL,
  6. pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
  7. },

但每次我都遇到这个错误:
发送电子邮件时发生错误:无效的登录: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:

  1. host: "smtp.hostinger.com",
  2. port: 465,
  3. secure: true,
  4. auth: {
  5. user: process.env.GRIEVANCE_EMAIL,
  6. pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
  7. },

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

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

  1. host: "smpt.hostinger.com",
  2. secure: true,
  3. secureConnection: false,
  4. tls: {
  5. ciphers: "SSLv3",
  6. },
  7. requireTLS: true,
  8. port: 465,
  9. debug: true,
  10. connectionTimeout: 10000,
  11. auth: {
  12. user: process.env.GRIEVANCE_EMAIL,
  13. pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
  14. },
英文:

The problem got solved using this configuration:

  1. host: "smpt.hostinger.com",
  2. secure: true,
  3. secureConnection: false,
  4. tls: {
  5. ciphers: "SSLv3",
  6. },
  7. requireTLS: true,
  8. port: 465,
  9. debug: true,
  10. connectionTimeout: 10000,
  11. auth: {
  12. user: process.env.GRIEVANCE_EMAIL,
  13. pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
  14. },

答案2

得分: 0

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

  1. host: "smtp.titan.email",
  2. port: 465,
  3. secure: true,
  4. auth: {
  5. user: process.env.GRIEVANCE_EMAIL,
  6. pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
  7. },
英文:

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

  1. host: "smtp.titan.email",
  2. port: 465,
  3. secure: true,
  4. auth: {
  5. user: process.env.GRIEVANCE_EMAIL,
  6. pass: process.env.GRIEVANCE_EMAIL_PASSWORD,
  7. },

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:

确定