Plesk - cannot send emails, ports 25/587 blocked
A plesk server shows the following warning with mailserver and email settings:
You cannot send emails from Plesk because outbound connections on TCP ports 25 and 587 are blocked. Check the firewall settings or contact your hosting provider. If you are sure that the ports are already open, Plesk can recheck them.
Check your firewall with iptables
Log in via ssh as root and check if any firewall rules are set. The following example shows the three default chains named INPUT, FORWARD and OUTPUT without any rules, so no connections are blocked even if Plesk does report it.
[root@server ~]# iptables -L -v -n Chain INPUT (policy ACCEPT 2004K packets, 1542M bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1919K packets, 3081M bytes) pkts bytes target prot opt in out source destination
Check smtp connections manually
Using a tool like telnet you can verify if a mailserver is reachable via smtp on port 25:
[root@server ~]$ telnet lm1.mailserver.eu 25 220 lm1.mailserver.eu ESMTP Postfix QUIT 221 2.0.0 Bye
Just wait until the 220 lm1.mailserver.eu ESMTP Postfix line (or similar) appears, it might take a few seconds. Then just enter QUIT, press return and cancel the connection by pressing STRG d. This is part of the protocol that mailservers use to communicate - if it works, your connection is not blocked.
Solution
This bug is tracked as PPPM-11528 and should have been fixed for Plesk Obsidian in March 2020. Unfortunately this also happend on a server that has all the latest updates (July 2020).
The official workaround is to close and ignore the error message.