SMTP connection timed out

Hi everyone,

I am currently trying to setup indico (v.3.3.5) with docker-compose, everything seems to be working fine, but for some reason I do not manage to setup the SMTP. The SMTP settings below were tested already using other applications running on the same server, so there should not be any connection issues, but for Indico they seem to not be working…

In my indico.conf I have listed:

SMTP_SERVER= ("smtp.example.com", 587)
SMTP_LOGIN="username"
SMTP_PASSWORD="passwd"
SMTP_USE_TLS=True
SMTP_ALLOWED_SENDERS={"mail@example.com"}
SMTP_SENDER_FALLBACK="mail@example.com"
NO_REPLY_EMAIL="mail@example.com"

Whenever I try to send and request an email (password reset etc.), the /opt/indico/log/indico.log file says something like:
025-03-18 20:18:41,156 WARNING 0000000000000000 - indico.emails Could not send email "[Indico] Reset your password" (attempt 3/10); retry in 120s [Connection unexpectedly closed: timed out]

When I do SMTP_USE_CELERY=False, the logs are a bit more detailed, but in the end I also receive smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out

I guess I might just be using some of the input parameters in indico.conf in the wrong way, but couldn’t really get it from the documentation available…any help would be greatly appreciated!

Must be a networking issue, maybe w/ your docker setup. Not much we can do there to help…

Is your mail server in a container? May be your indico container is not resolving dns. Can you ping domains from inside the container?

The indico container is resolving DNS and I can reach the mail server from within the container, for example using openssl s_client -connect ..., so this does not seem to be the issue.

If I use an invalid SMTP_SERVER address, the error message is different:

2025-03-19 10:29:09,785  WARNING  0000000000000000  -       indico.emails             Could not send email "[Indico] Reset your password" (attempt 1/10); retry in 30s [[Errno -2] Name or service not known]

Not sure how to further debug this issue…

It does seem to be some sort of a connection issue between indico and the mail server that I am trying to use. I tried using a different email account from another provider, it works (TLS on port 587)

Still not sure why the other one (that is working for other applications) won’t do it for Indico.
Possible issues I can think of that might cause trouble:

  • SMTP_LOGIN is and actual username and not the same as NO_REPLY_EMAIL, could this be an issue?

  • The actual TLS port of the email server I used first is 465 (not the default 587), but even if I set it correctly in SMTP_SERVER variable (SMTP_SERVER=(smtp.example.com, 465)), I get the connection issue error. Is it possible that somehow SMTP_USE_TLS=True defaults to the standard TLS port 587? Is there any way to check the actual settings that are used internally to connect to the mail server?

No. SMTP_LOGIN is whatever username the SMTP servers expect when doing SMTP AUTHentication.

I think there we have the culprit. You’d probably trying to do STARTTLS on an always-on-TLS socket, which won’t work. Currently there is no setting to use always-on-TLS in Indico, especially since it’s quite uncommon for SMTP servers to not use STARTTLS.

1 Like