-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
Context:
- Self-hosted on EC2
- Docker compose deployment
SMTP setup was completed using Google smtp-relay. Test emails were succesfully sent.
However, when adding new users, intermittently Google would close the connection prior to HELO with a 421 4.7.0 code. Therefore, these emails were never sent. Users couldn't log in.
Upon investigation:
Nodemailer uses os.hostname() for the SMTP EHLO greeting. In Docker containers, this returns the container ID (e.g., e508959023b2) instead of a valid FQDN. Google's SMTP relay rejects non-FQDN hostnames in EHLO, but inconsistently - causing intermittent failures.
Workaround:
Set hostname: your.domain.com in Docker Compose for the Rocket.Chat container.
Suggested Fix:
Expose nodemailer's name option in Rocket.Chat's SMTP settings (Admin → Email → SMTP). This option sets the EHLO hostname explicitly, independent of the container's system hostname.
References:
Nodemailer name option: https://nodemailer.com/smtp/ ("optional hostname of the client, used for identifying to the server")
Similar issue in other frameworks: loco-rs/loco#1055