LSR
LSR

Reputation: 93

Nodemailer Gmail timeout

I am having trouble with sending emails to my Gmail account. I am getting a timeout error. And it puzzles me, because I basically copied the settings from a working project I did before. But then I tried the working project, and it gives me the same error. As far as I know Nodemailer's default port for Gmail is 465 which uses SSL, so this is turned on. I have tried three different Gmail accounts, two have 2FA, one of them has setup XOAuth, the third I turned on less secure apps. Everything failed with the same error.

Here is the code snippet, where I think the trouble is:

smtpConfig =
  service: "Gmail"
  connectionTimeout : "7000" #waiting for 60s is annoying
  greetingTimeout : "7000"
#  auth:
#    XOAuth2:
#      user: receiverEmail
##      pass: appSpecificPassword
#      clientId: myClientId
#      clientSecret: itIsMySecret
#      refreshToken: myRefreshToken
  auth:
    user: receiverEmail
    pass: appSpecificPassword
  secure: true # use SSL
  debug: true

I later put it into a function. In between I had to put the envelope together.

smtpTrans = nodemailer.createTransport(smtpTransport(smtpConfig), ->
   #Setup configs are on top, because we need to config before we use the POST method according to express
)

This one doesn't even fire, when you put a console.log in there.

On Nodemailers Github I found the following to try out in the terminal:

openssl s_client -crlf -connect smtp.gmail.com:465

which should give a nice 200 response, but it doesn't, it gives me a timeout. Every other available port responded with the same. I asked a friend to try it out on his computer and it works fine for him. So I am back searching for the problem on my computer - maybe on my operating system, node version, do we setup the configs differently and I didn't notice? I am running out of options, so I am seeking for help here.

My firewall is off, no fuzzes about setting up extra ports in this case.

Upvotes: 1

Views: 1522

Answers (1)

LSR
LSR

Reputation: 93

After extensive checking with my system and my internet provider I found that my router didn't like my internal IP address. So I renewed my DHCL leasing.

If you ever encounter the same problem, here are some tips for debugging.

  1. Check for viruses: Along my deep research on the internet, I found the tip that viruses can block ports. So if you don't have a scanner, download one.

  2. Check your firewall: Most common trouble. I checked my firewall and noticed it was offline.

  3. Use network utilities: Do a port scan and try to ping the IP addresses

  4. Check your email address with your local email client, try to send an email. Check incoming server and outgoing server configurations.

  5. Check your network: Ask your provider if it is blocking email providers. Renew your network configurations.

  6. Check your Google account if it is blocking your IP address. Happens often, if you send out a bunch of emails marked as spam, or if your account was hacked and used by somebody to send out spam.

Upvotes: 1

Related Questions