Search code examples
javascriptnode.jsnodemailer

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.


Solution

  • 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,
    },