[SOLVED] Nextcloud cannot connect to SMTP server known to be running: how to fix?

Nextcloud version (eg, 20.0.5): 21.0.0
Operating system and version (eg, Ubuntu 20.04): Debian 10 (via Linode Marketplace app)
Apache or nginx version (eg, Apache 2.4.25): Apache, version don’t know.
PHP version (eg, 7.4): PHP, version don’t know.

The issue you are facing:
Error message on Nextcloud admin pages to configure an SMTP connection, triggered by the “send email” testing button:

“A problem occurred when sending the email. Please revise your settings. (Error: Connection could not be established with the host mail.privateemail.com :stream_sock_client(): unable to connection to tcp://mail.privateemail.com:587 (Connection timed out)).”

The mail server’s instructions are here: https://www.namecheap.com/support/knowledgebase/article.aspx/1179/2175/general-private-email-configuration-for-mail-clients-and-mobile-devices/

Screenshot of error message here: https://drive.google.com/open?id=1v8vvuR0eB-8KaM7s-mil4U5-6kopxCa-

Screenshot of server’s firewall here: https://drive.google.com/open?id=1wtSHo8_MPKzlK3RR4Ejrc0sBvDZKmb-s

Is this the first time you’ve seen this error? (Y/N): Yes.

The output of your Nextcloud log in Admin > Logging: no entries relate to this issue.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!): don’t understand what this means.

The output of your Apache/nginx/system log in /var/log/____: not relevant.

I’d be grateful for assistance for any fixes or further diagnosis.

Turns out that the host had its own firewall, to block SMTP ports and protocols. An anti-spam measure.

Case closed.

1 Like

I am having the same problem hosting on Linode. Any insight to the resolution would be amazing :slight_smile:

I looked in my linode firewall and dont have any firewalls setup