Problem with the mail server

I installed nextcloud in a dedicated Raspberry and everything works correctly.
I only have one problem:
The mail server does not work (for sending notifications and password recovery).
I set all the parameters correctly (used in other occurrences) but the error message is:
There was a problem sending the email. Check your settings. (Error: Connection could not be established with host [# 0] Log data: ++ Starting Swift_SmtpTransport !! Connection could not be established with host [# 0] (code: 0))
I attach the screen.
Do I have to configure anything else to enable the Raspberry?
Thanks in advance for the help

Gustavo Caprioli

shouldn’t it be instead of

Probably not a good idea to post issues with screenshots of domain names.

You’re right I didn’t have to post the domain data. When it works I will delete this account and make a new one.
The server is and I’m sure the parameters entered are correct. They work in other environments.
I don’t know if the problem is some configuration of the Raspberry.
Thanks a lot, do you have any ideas?

What do you mean with “They work in other environments”?

If you are trying to say, that the parameters work on other machines in your network, it could be a network/firewall configuration problem on your Raspberry.

I just tried a ping and a traceroute to the above host - The hoster seems to block ICMP request, so a traceroute would be the only option to test.

Connect to your Rapsberry and from there do traceroute to see if your Raspberry is able to resolve the host to its source.

Thank you so much for your help
From my network other devices with the indicated parameters work correctly.
From the Raspberry I tried to send mail (with the address we are talking about) with the command:
echo “email text” | mail -s “test” and at the address indicated the e-mail has arrived correctly.
The result of the traceroute is:
root@DietPi:/# traceroute
traceroute to (, 30 hops max, 60 byte packets
1 ( 1.321 ms 1.306 ms 1.386 ms
2 ( 4.924 ms 4.911 ms 4.885 ms
3 ( 13.893 ms 17.813 ms 15.100 ms
4 ( 17.690 ms 17.676 ms ( 17.669 ms
5 ( 21.503 ms 22.779 ms 21.452 ms
6 ( 18.759 ms 16.842 ms 12.851 ms
7 ( 14.219 ms 15.488 ms ( 12.825 ms
8 ( 27.226 ms ( 31.119 ms 32.397 ms
9 ( 25.820 ms 29.708 ms 25.780 ms
10 ( 38.825 ms 48.009 ms 40.095 ms
11 ( 40.036 ms 40.039 ms 37.225 ms
12 ( 49.014 ms 37.915 ms 40.590 ms

The traceroute looks good and if the mail sent via the shell arrived as well, it must be something else.

Please try the following:

Connect to your Raspberry and change to the directory with your webserver logs (Apache or whatever you are using). Now enter tail -f error_log_file and execute the mail test in Nextcloud again. Hopefully the webserver error_log shows a little more information on what is going on.

I still think that something is blocking the port 465

I’m sorry but I’m not very experienced,
I entered the / var / log / apache2 folder which contains “access.log error.log other_vhosts_access.log”. I launched the command you suggested to me “tail -f error_log_file” but the file does not exist.
I ran tail -f error.log but the system does not respond.
What am I doing wrong?
Thanks a lot

I’m not very experienced, someone can help me.
Thank you very much in advance