Symptoms
Mail to an external domain is not delivered. The following entries can be found in
/var/log/maillog:# status=bounced (mail for example.com loops back to myself)
# postfix/smtp[30738]: warning: host mail.example.com[203.0.113.2]:25 greeted me with my own hostname c1.example.com
Unable to get root email delivered externally. In
/etc/aliasesthe following entries can be found:# tail /etc/aliases
# Person who should get root's mail
root: [email protected]
Cause
The remote server thinks that he is sending mail to itself. Possible reasons:
- IP Address of MX record for recipient's domain points to Plesk server
-
myhostnameparameter in/etc/postfix/main.cfis the same on both sender and recipient servers
Resolution
Connect to the server via SSH.
Make sure first that IP address of the recipient's domain does not belong to the Plesk server:
# host example.com
example.com has address 203.0.113.2
example.com mail is handled by 0 example.com.
# ip a | grep 203.0.113.2
inet 203.0.113.2/32 brd 203.0.113.2 scope global venet0:0On the example above, IP address 203.0.113.2 belongs to sender server. That is why Postfix falls in a loop.
Correct the DNS setting to resolve the issue. If DNS is handled by a third-party name server, correct DNS settings in Plesk accordingly.
In case IP address does not point to the same server, check
myhostnameon a source and compare with hostname from the log:# postconf | grep myhostname
myhostname = c1.example.com
# postfix/smtp[30738]: warning: host mail.example.com[129.168.0.1]:25 greeted me with my own hostname c1.example.comIf they are equal, it is required to change
myhostnamein/etc/postfix/main.cffile.As an additional step, it may be necessary to add a required domain name to
mydestinationline. It should look as follows:mydestination = localdomain, localhost, localhost.localdomain, localhost, example.com
and restart postfix using the following command:
# service postfix restart