MBF Knowledge Base

How can I solve "MX list for hostname points back to hostname" and "config error: mail loops back to myself" messages?

You have asked mail sent to a domain (e.g., domain.net) to be forwarded to a specific host (in this case, relay.domain.net) by using an MX record, but the relay machine doesn't recognize itself as domain.net. Add domain.net to /etc/mail/local-host-names [known as /etc/sendmail.cw prior to version 8.10] (if you are using FEATURE(`use_cw_file')) or add "Cw domain.net" to your configuration file.

There are a couple of additional cases where you don't actually want local delivery, and thus adding domain.net to class w is not the right fix:

When relay.domain.net should just be acting as a forwarder, e.g. a firewall/gateway box. The proper fix could be to set up a mailertable entry for domain.net.

When relay.domain.net is a secondary (etc.) MX, and the MX mistakenly points to a CNAME or other "non-canonical" name [this gives "config error: mail loops back to me (MX problem?)"]. The proper fix is to point the MX at the actual name, a "work-around" to add the MX target to class w.

Important: When making changes to your configuration file, be sure you kill and restart the sendmail daemon (for any change in the configuration, not just this one):

kill -HUP `head -1 /var/run/sendmail.pid`

Note: You can also get this error message (MX loops ...) when two sendmail systems talk to each other, and both have the same value of $j . The best solution is "don't do that."