Looking for some insight into this error I'm getting.
on smtpTransport.sendmail(func(err, info){})
The err variable returns this:
Error: getaddrinfo ENOTFOUND smtp.gmail.com smtp.gmail.com:465
       at errnoException (dns.js:50:10)
       at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
and my code is:
var smtpTransport = nodemailer.createTransport({
                service: 'Gmail',
                auth: {
                    user: '[email protected]',
                    pass: 'xxx'
                }
            });
            var mailOptions = {
                to: user.email,
                from: '[email protected]',
                subject: 'Node.js Password Reset',
                text: ' '
            };
            smtpTransport.sendMail(mailOptions, function(err) {
            });
        }
    ], function(err) {
    });
The error getaddrinfo ENOTFOUND localhost is caused by Webpack cannot found localhost address. To solve it, open the terminal: sudo nano /etc/hosts. Add following into the hosts file and save it.
getaddrinfo ENOTFOUND means client was not able to connect to given address. Please try specifying host without http: var optionsget = { host : 'localhost', port : 3010, path : '/quote/random', // the rest of the url with parameters if needed method : 'GET' // do GET };
Try stop using gmail service and set it up like any other smtpTransport like the following.
var smtpTransport = nodemailer.createTransport({
    host: 'smtp.gmail.com',
    port: 465,
    secure: true, // use SSL
    auth: {
        user: '[email protected]',
        pass: 'pass'
    }
});
If This does not work, your server might not be able to lookup smtp.gmail.com due to a firewall or something, to check type the following.
 nslookup smtp.gmail.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With