Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send email using nodemailer with hostinger professional email?

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.

like image 862
Mouzin Gulzar Avatar asked Sep 06 '25 08:09

Mouzin Gulzar


2 Answers

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,
},
like image 142
Michael Sinclair Avatar answered Sep 08 '25 21:09

Michael Sinclair


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,
},
like image 40
Mouzin Gulzar Avatar answered Sep 08 '25 20:09

Mouzin Gulzar