Nodemailer: ETIMEDOUT / ECONNECTION Email / SMTP Origin: Network OSI layer 4 · Transport Last updated 4 Nov 2026

Nodemailer: Error: connect ETIMEDOUT 142.250.27.108:465 (code: 'ETIMEDOUT', command: 'CONN')

Nodemailer could not open a connection to the SMTP server before the timeout — a blocked port, wrong host, or network issue.

Exact message you may see Error: connect ETIMEDOUT (code: 'ETIMEDOUT', command: 'CONN')Nodemailer ETIMEDOUTError: connect ECONNREFUSED 127.0.0.1:587 nodemailercode: 'ECONNECTION'Connection timeout nodemailer
Seen on: SMTP Node.js Linux

Meaning

Cloud hosts and home ISPs often block outbound SMTP ports (25, sometimes 465/587). ETIMEDOUT means packets got no answer; ECONNREFUSED means a host answered but nothing is listening. Test with nc or telnet, try another port, or use an HTTP API-based ESP, which avoids SMTP ports.

Common causes

  • Outbound SMTP ports blocked by cloud provider/ISP/firewall
  • Wrong host or port
  • IPv6 resolution to an unreachable address
  • Corporate proxy
  • Slow DNS

⚡ Quick fix

  1. Test with nc -vz smtp.example.com 587
  2. Try 587 STARTTLS or 2525 (many ESPs accept it)
  3. Use the provider's HTTP API if SMTP is blocked

Detailed fix by platform

Linux

  1. nc -vz smtp.gmail.com 587 and nc -vz smtp.gmail.com 465

Code examples

Explicit ports and timeouts

javascript
const nodemailer = require("nodemailer");
const t = nodemailer.createTransport({
  host: "smtp.example.com", port: 587, secure: false,
  connectionTimeout: 15000, greetingTimeout: 15000,
  auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS },
});

How to diagnose

  1. Port — Reachable with nc?
  2. Host — Correct?
  3. Cloud — Outbound SMTP restricted?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

421 4.7.0 Try again later (rate limited) — SMTP: 421 4.7.0 Our system has detected an unusual rate of unsolicited mail originating from your IP address. Mail sent from your IP address has been temporarily rate limited (Email / SMTP)421 4.7.0 Try again l…450 4.7.1 Greylisted, please try again later — SMTP: 450 4.7.1 <user@example.com>: Recipient address rejected: Greylisted, see http://postgrey.schweikert.ch/help/example.com.html (Email / SMTP)450 4.7.1 Greylisted,…ConnectionRefusedError [Errno 111] (SMTP) — Python: ConnectionRefusedError: [Errno 111] Connection refused — smtplib connect to localhost:25 (Email / SMTP)ConnectionRefusedErro…Laravel: Connection could not be established with host — Laravel: Symfony\Component\Mailer\Exception\TransportException: Connection could not be established with host "smtp.mailtrap.io:2525": stream_socket_client(): Unable to connect (Email / SMTP)Laravel: Connection c…Nodemailer: EAUTH Invalid login — Nodemailer: Error: Invalid login: 535-5.7.8 Username and Password not accepted (code: 'EAUTH', responseCode: 535) (Email / SMTP)Nodemailer: EAUTH Inv…Nodemailer: Greeting never received — Nodemailer: Error: Greeting never received (code: 'ETIMEDOUT', command: 'CONN') (Email / SMTP)Nodemailer: Greeting …Outbound port 25 blocked — SMTP: telnet smtp.example.com 25 — Connection timed out (cloud provider blocks port 25) (Email / SMTP)Outbound port 25 bloc…Redis connection refused (Laravel) — Laravel: Predis\Connection\ConnectionException: Connection refused [tcp://127.0.0.1:6379] / RedisException: Connection refused (Laravel)Redis connection refu…Nodemaile…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.