Symptoms
-
There are multiple IPs on the server. For example: 203.0.113.2 and 203.0.113.111
-
Mail messages are sent successfully from 203.0.113.2
-
Mail messages are stuck in mail queue after changing Outgoing mail IP to 203.0.113.111 going to Plesk > Tools & Settings > Mail Server Settings > Outgoing mail mode > Send from the specified IP addresses:
-
There are the following records inÂ
/var/log/maillog
:postfix/smtp[2398]: 674761A0895: to=<[email protected]>, relay=none, delay=688, delays=537/0.02/151/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[173.194.203.26]:25: Connection timed out)
postfix/smtp[2397]: connect to alt4.gmail-smtp-in.l.google.com[173.194.203.26]:25: Connection timed out -
Checking 203.0.113.111 shows that the IP is not blacklisted
-
It is possible to connect to google mail server via 25 port from the old IPÂ (Â 203.0.113.2):
Note: It might be required to install Ncat package to check the following symptom
# nc -v -w5 -s  203.0.113.2 173.194.203.26 25
Ncat: Connected to 173.194.202.26:25.
220 mx.google.com ESMTP d15si36358376pgi.541 – gsmtp -
 The connection from the new IP ( 203.0.113.111 ) fails with a timeout message:
Note: It might be required to install Ncat package to check the following symptom
# nc -v -w5 -s  203.0.113.111 173.194.203.26 25
Ncat: Connection timed out.
Cause
Network misconfiguration: Outbound connections through port 25 from the selected IP address are blocked on the server.
Resolution
-
Connect to the server via SSH
-
Install Ncat package:
-
CentOS/RedHat/CloudLinux OS:
# yum install nc
-
Debian/Ubuntu OS:
# apt-get install netcat
-
-
Run the following command to check which IP address reaches the external mail server:
# MAILSERVER=”173.194.203.26“; RE=”[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}”; if [[ $MAILSERVER =~ ^${RE}$ ]]; then for IP in `ip a | egrep -o ${RE} | egrep -v 255$|^127|0.0.0.0 | sort | uniq`; do echo -e “nChecking connection: $IP -> $MAILSERVER:25”; nc -z -w5 -s $IP $MAILSERVER 25 &>/dev/null; err=`echo $?`; if [ $err -eq 0 ]; then echo -e “Success: Connection works”; elif [ $err -eq 1 ]; then echo -e “Error: Connection failed”; elif [ $err -eq 127 ]; then echo -e “nError: Install Ncat package”; kill -INT $$; else echo -e “nError: Unexpected error code”; kill -INT $$; fi; done; else echo -e “nError: The value is not an IP address”; fi
* Where
MAILSERVER
parameter is the external mail IP address that cannot be reached according to the error logs -
According to the results from the previous command, apply one of the following solutions:
-
Change the default IP address capable to connect to the external mail servers: Log in to Plesk GUI > Tools & Settings > Mail Server Settings >Â Outgoing mail mode > Send from the specified IP addresses
-
In case all the IP addresses are not capable to connect to the external mail server, check the server network configuration:Â Unable to send emails using Plesk local mail server
-