8

Looking for some insight into an error I'm getting.

on transporter.sendmail(func(err, info){}), the err variable returns this:

{ [Error: getaddrinfo ENOTFOUND smtp.gmail.com]
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'smtp.gmail.com' }

I don't see any error documentation for nodemailer on their site or github, and I haven't found anything useful on Google searches. The closest I see is this SO post. I am trying to send about 50 emails once a week through a cron job.

I have tried this with and without the nodemailer-smtp-pool package, and my transporter currently looks like this:

var transporter = nodemailer.createTransport(smtpPool({
  service: 'gmail',
  auth: {
    user: 'xxx@gmail.com',
    pass: 'xxx'
  },
  maxConnections: 5,
  maxMessages: 200
}));

I am not using XOATH yet, because I'm not under the impression that I need to. I have removed the DisplayUnlockCaptcha for the gmail account I'm using, but I don't think that's related. For what it's worth, I'm using the MEAN stack for this app.

It looks like 'smtp.gmail.com' is not being found when nodemailer makes the getaddrinfo call, but I can't understand why.

Any insight is appreciated

edit:

from the developer of nodemailer:

ENOTFOUND means that the app was not able to resolve DNS A record for smtp.gmail.com. Probably something wrong with your DNS server. This is handled by Node and not by Nodemailer, there's nothing Nodemailer can do if a hostname is not resolved. If this happens randomly then you could edit your application to try again in a moment.

and it doesn't look like nodemailer supports proxies, or ever plans to. looks like a dead end to me.

Community
  • 1
  • 1
Token
  • 81
  • 1
  • 5
  • 1
    Have you tried using 'secure: true'? How about using host: smtp.gmail.com and port: 465 instead of the service option? – Prasad Silva Apr 10 '15 at 03:31
  • I got this to working using 465 and specifically allowing and unlocking app access in gmail security settings. – james-see Mar 10 '16 at 21:50

2 Answers2

0

I had the same error with my nodemailer setup and I fixed it by changing the gmail password to not include any special characters.

Žan Marolt
  • 136
  • 1
  • 3
  • 10
0
var transporter = nodemailer.createTransport(smtpPool({
  service: 'gmail',
  secure: false, // true for 465, false for other ports
  auth: {
    user: 'xxx@gmail.com',
    pass: 'xxx'
  },
  maxConnections: 5,
  maxMessages: 200
}));

Try this, It should work fine.

Tushar Joshi
  • 1
  • 1
  • 4