Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to send email via nodemailer in nodejs

I using below configuration for sending an email via Nodemailer but unable to send it and it is thrown error: getaddrinfo ENOTFOUND ssl://smtp.googlemail.com ssl://smtp.googlemail.com:587 at GetAddrInfoReqWrap.onlookup

Configuration:

host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
    user: '[email protected]',
    pass: 'xxxx'
}

enter image description here

Anyone can give me a solution to solving it soon?

like image 543
Kamlesh Avatar asked Sep 05 '25 20:09

Kamlesh


1 Answers

Try to add service parameter with value gmail.

var smtpTransport = nodemailer.createTransport({
    service: 'gmail',
    port: 8000,
    secure: false, // use SSL
    auth: {
        user: '[email protected]',
        pass: 'pass'
    }
});

Refer How to send mail using nodemailer

like image 149
Shivani Sonagara Avatar answered Sep 08 '25 10:09

Shivani Sonagara