I have a mail server on 172.17.0.1 and I can connect to it and send mail by exec’ing into to the docker container and using netcat. I tried enabling DEBUG=* and it didn’t even mention anything about mail but I can’t send 2FA emails from within ghost, it says there was an error and to check the logs, which say ESOCKET but I don’t understand why the environment variables seem correct.
I also tried editing the configuration files inside the container and adding mail rules to them then restarting the container but this doesn’t work either.
My only option is to disable 2FA. I’d like to keep it though. Any advice?
2025-07-03T22:58:40.015329+01:00 blog postfix/smtpd[102835]: connect from unknown[172.18.0.3]
2025-07-03T22:58:40.024169+01:00 blog postfix/smtpd[102835]: SSL_accept error from unknown[172.18.0.3]: lost connection
2025-07-03T22:58:40.024644+01:00 blog postfix/smtpd[102835]: lost connection after STARTTLS from unknown[172.18.0.3]
2025-07-03T22:58:40.024771+01:00 blog postfix/smtpd[102835]: disconnect from unknown[172.18.0.3] ehlo=1 starttls=0/1 commands=1/2
As for errors from ghost:
[2025-07-03 21:58:40] ERROR "POST /ghost/api/admin/session" 500 339ms
Failed to send email. Please check your site configuration and try again.
"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error ID:
e0caf890-5858-11f0-82ee-a709bc14eca4
Error Code:
ESOCKET
----------------------------------------
EmailError: Failed to send email. Please check your site configuration and try again.
at Object.sendAuthCodeToUser (/var/lib/ghost/versions/5.129.0/core/server/services/auth/session/session-service.js:284:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.createSession (/var/lib/ghost/versions/5.129.0/core/server/services/auth/session/middleware.js:16:17)
So I poked around in the code a bit and removed the “friendly” error and it’s failing because postfix has a self-signed certificate. Why that’s a problem for it I don’t know but I can probably go from here and patch out that code.
Ahha. Ghost is using nodemailer under the hood. You might find this config page useful. SMTP transport | Nodemailer . You can probably pass in tls__rejectUnauthorized: false (check doc for exact name) to stop that, rather than maintaining a patched-out version. :)