I have been able to avoid timeouts by using port 587 instead 465 (source of the idea: https://github.com/chatwoot/chatwoot/issues/7869#issuecomment-1921519824). Turns out my provider supports port 587, even though they officially advertise 465 and for some reason 587 works.