The user gi1242 reported that SMTP email stopped working on their Discourse site after 10 days, despite curl tests succeeding. The issue was traced to a 7-second delay on the host server for incoming mail, causing Discourse’s default 5-second timeout to fail. Increasing the DISCOURSE_SMTP_OPEN_TIMEOUT and DISCOURSE_SMTP_READ_TIMEOUT to 10 seconds in app.yml resolved the problem gi1242. supermathie suggested the delay might be due to DNS reverse lookup timeouts, which was confirmed by gi1242. As a workaround, static IP addresses with dummy hostnames were added for Docker’s typical IP range to prevent DNS lookup delays.
I’ve had my site running for a few years without issue now. All of a sudden, SMTP simply stopped working. (I made no config changes on host or in the container).
I’m using SMTP (not SMTPS). I entered the discourse container and tested that I could send mails using curl:
I chased the problem down. Turns out the host is now imposing a 7 second delay on all incoming mail (even from containers). Discourse times out by default in 5 seconds.
I increased it to 10 seconds in containers/app.yml:
It works now… but does anyone know how to get rid of the postfix delay on the host? I’ve been searching through the config files but cant find anything…
Ha! Thank you so much! This was exactly the problem.
I just added static IP addresses (with dummy host names) for all IP addresses docker will typically assign (172.17.0.2 through 10). So if my container comes up with a different IP, hopefully it won’t stall on the nslookup.
I wonder if there’s a way for docker to resolve IP addresses of alll containers…