Connection time out | smtp server

When setting up the mail server in the settings, I get an error. I tried this with different domains (different mail service providers) but the error is identical. Error text:

Во время отправки письма произошла ошибка. Пожалуйста проверьте настройки. (Ошибка: Connection could not be established with host :stream_socket_client(): unable to connect to ssl:// (Connection timed out))

Nextcloud v.21.0.4 installed in the docker container
PHP v.7.4.23
nginx 1.14.1 from the system redirects the request to the container nginx. I am at a loss to name the version of nginx that is installed in the container and processes requests to nextcloud, I do not know how to look at this
CentOS 8

I think it is unlikely that the problem is in nginx, but it could be. Any help would be welcome :slight_smile: If you need logs, please let me know