Self-hosted Instance Cannot Send E-mails

Description

Hi!

My instance cannot send e-mails using Gmail. The logs show “Error: Connection timeout”. I can send e-mails manually though.

From my server, I can connect manually to smtp.gmail.com using openssl s_client -connect ``smtp.gmail.com:465`` -crlf and send a few emails successfully.

From my instance, using the same Google server, the same credentials, I cannot send e-mails. I configured my instance to show errors and information in the logs. Using journalctl -u snap.rocketchat-server.rocketchat-server -f, I see

Nov 05 21:12:09 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]: {"level":35,"time":"2025-11-05T21:12:09.293Z","pid":77253,"hostname":"PtidejPortal-2025-2029","name":"Meteor","method":"sendSMTPTestEmail","userId":"gPwyT4oyCrKySThRa","remoteIP":"132.205.229.40","instanceId":"33c55734-f859-4a0f-8640-d0ed20522b43"}
Nov 05 21:12:09 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]: {"level":35,"time":"2025-11-05T21:12:09.304Z","pid":77253,"hostname":"PtidejPortal-2025-2029","name":"API","method":"POST","url":"http://localhost/api/v1/method.call/sendSMTPTestEmail","userId":"gPwyT4oyCrKySThRa","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36","length":"96","host":"chat.ptidej.net","referer":"https://chat.ptidej.net/admin/settings/Email","remoteIP":"132.205.229.40","status":200,"responseTime":21}
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]: Error: Connection timeout
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:     at SMTPConnection._formatError (/snap/rocketchat-server/1738/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:     at SMTPConnection._onError (/snap/rocketchat-server/1738/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:776:20)
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:     at Timeout.<anonymous> (/snap/rocketchat-server/1738/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer/lib/smtp-connection/index.js:235:22)
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:     at listOnTimeout (node:internal/timers:594:17)
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:     at processTimers (node:internal/timers:529:7) {
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:   code: 'ETIMEDOUT',
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]:   command: 'CONN'
Nov 05 21:12:19 PtidejPortal-2025-2029 rocketchat-server.rocketchat-server[77253]: }

I configured Rocket.Chat with:

  • Protocol: smtp
  • Host: smtp.gmail.com
  • Port: 465
  • IgnoreTLS: off
  • Pool: on
  • Username: <my Gmail username with @gmail.com>
  • Password: <the 16 chars of an App password>
  • From Email:

Server Setup Information

  • Version of Rocket.Chat Server: 7.12.0
  • Operating System: Ubuntu v22.04
  • Deployment Method: snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 22.13.1
  • MongoDB Version: 6.0.19
  • Proxy: nginx
  • Firewalls involved: ufw

Any additional Information

Real answer is don’t use Google :slight_smile:

They don’t want you too anyway.

This may help you, but eventually they’ll probably block most “app” access without 2FA.

Hi @reetp and thank you for your answer!

I was trying to use the exact same configuration as I am using for Ghost, but your answer led me to try using smtps instead of smtp and it now works!

For others who’d like to use Gmail anyway, here’s my configuration that works:

  • Protocol: smtps (yes, the secure one)
  • Host: smtp.gmail.com
  • Port: 465
  • IgnoreTLS: doesn’t matter, it’s disabled by the choice of smtps above
  • Pool: off
  • Username: <username>@gmail.com
  • Password: one App password
  • From Email: <username>@gmail.com

Cheers!
Yann

No need to @

Yup in 2025 use s everywhere.