20 days ago
Hello,
I am writing to report a persistent, critical error with outbound email delivery from my Node.js application deployed on a cloud platform (Railway). The issue appears to be an IP/network block from the Google side, as the connection consistently times out before authentication can even begin.
Despite implementing the most robust configurations, the service remains non-functional.
1. Environment Details
Backend: Node.js / Express
Mailer Library: Nodemailer
Authentication Method: Gmail OAuth2 (using Client ID, Client Secret, Refresh Token)
2. Error Logs and Symptoms
The application starts successfully, connects to the database, and begins the email job, but fails with a connection timeout (ETIMEDOUT).
Log Output (Repetitive Failure):
...
Register route HIT: 6920a54459aeaa4ad430c58b { ... }
š§ Sending OAuth2 email to: rishikumar.cs24@bmsce.ac.in (via Port 465 | IPv4)
... it is struck in this
ā OAuth2 Email Error: Error: Connection timeout
at SMTPConnection._onError (../nodemailer/lib/smtp-connection/index.js:795:20) {
code: 'ETIMEDOUT',
command: 'CONN'
}
I have ruled out common configuration errors and verified the following:
Configuration CheckStatusNotesAuthentication MethodPassedSwitched from simple password to the secure Gmail OAuth2 (Client ID/Refresh Token). Auth is not the issue.Blocking Logic (Frontend)PassedRemoved await sendEmail(...) calls to ensure the server responds instantly, even if the email fails ("fire-and-forget").Password FormatPassedConfirmed 16-character App Passwords are used without spaces (when testing the legacy method).Port & ProtocolFailedTested both standard ports, each resulting in ETIMEDOUT.IPv6 Blocking FixFailedAdded the explicit family: 4 option to force IPv4 connection. The connection still times out, confirming a hard network block.Explicit Host/PortFailedTested explicit host: "smtp.gmail.com" with port: 465, secure: true (and later port: 587, secure: false). All attempts timed out.
0 Replies