Symptoms
-
Email messages can not be sent from a Plesk server on Digital Ocean:
# egrep "Connection timed out" /var/log/maillog | tail
example postfix/smtp[16848]: connect to aspmx.l.google.com[2001:db8:f61:a1ff:0:0:0:80]:25: Connection timed out -
The warning below may appear after the Daily Maintenance task execution in the Tools & Settings > Mail Server Settings or when applying settings in the Domains > example.com > Mail tab > Mail Settings menu:
You cannot send emails from Plesk because outbound connections on TCP port 25 is blocked. Check the firewall settings or contact your hosting provider. If you are sure that the ports are already open, Plesk can recheck them. Start the recheck.
-
Firewall is configured to allow outgoing traffic via IPv6:
ACCEPT tcp ::/0 ::/0 tcp dpt:25
Cause
SMTP traffic over IPv6 is blocked at the network level on the Digital Ocean side: https://www.digitalocean.com/docs/networking/ipv6/.
Resolution
As a workaround, the precedence over the getaddrinfo
calls can be modified to prioritize IPv4 over IPv6:
-
Connect to the server via SSH.
-
Open the
/etc/gai.conf
file in any text editor, for example, in the vi text editor:# vi /etc/gai.conf
For Debian/Ubuntu
- Remove the
#
symbol from the line below:
-
Before:
# precedence ::ffff:0:0/96 100
-
After:
precedence ::ffff:0:0/96 100
- Save the changes and close the file.
For RHEL/Centos
-
Add the line below to the
/etc/gai.conf
file:precedence ::ffff:0:0/96 100
-
Save changes and close the file.