Hello,
since view weeks sending mail from my Discourse instance fails. The SMTP settings are unchanged, curl test is still working but notably slow. The smtp server from our hoster (that we need to send mails with) has a consistent send time of 7 seconds.
cat testmail | curl -vvv --url 'smtp://smtp.<HOST>:587' --mail-from mail@<DOMAIN> --mail-rcpt <ME> --user "mail@<DOMAIN>:<PW>" -T -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying <IP>...
* Connected to smtp.<HOST> (<IP>) port 587 (#0)
< 220 mailproxy1.<HOST> Dovecot ready.
> EHLO ecm2
< 250-mailproxy1.<HOST>
< 250-8BITMIME
< 250-AUTH PLAIN LOGIN
< 250-BURL imap
< 250-ENHANCEDSTATUSCODES
< 250-SIZE
< 250-STARTTLS
< 250 PIPELINING
> AUTH PLAIN
< 334
> xxxxxx=
0 0 0 0 0 0 0 0 --:--:-- 0:00:06 --:--:-- 0< 235 2.7.0 Authentication successful
0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0> MAIL FROM:<mail@<DOMAIN>>
< 250 2.1.0 Ok
> RCPT TO:<<ME>>
< 250 2.1.5 Ok
> DATA
< 354 End data with <CR><LF>.<CR><LF>
} [89 bytes data]
100 89 0 0 0 89 0 11 --:--:-- 0:00:07 --:--:-- 20< 250 2.0.0 Ok: queued as 356C3288C85
100 89 0 0 0 89 0 11 --:--:-- 0:00:07 --:--:-- 26
* Connection #0 to host smtp.<HOST> left intact
I compared this to our internal mail server with <1 second per mail. The 7 seconds from the mail hoster would be no real problem, but I was unable to identify a setting where to lift the (seemingly hard-coded?) 5 seconds timeout. The open_timeout
and, as it seems to me, more relevant read_timeout
is also visible in the test interface at /admin/email
:
- Timings in the docker app container is identical to a local test or a test on the docker host.
- cURL sent mails are delivered correctly (after the 7 seconds wait + the blink of an eye).
- For privacy reasons, the usual workarounds like sendgrid, mailgun etc. are sadly no option.
- Maybe a switch to
ActionMailer
7.0.x triggerd this problem for me?- rails/actionmailer/CHANGELOG.md at v7.0.3.1 · rails/rails · GitHub
-
Configures a default of 5 for both
open_timeout
andread_timeout
for SMTP Settings.
Thank you for any idea how to configure read_timeout
.