Fix: 'config error: mail loops back to me (MX problem?)'
To prevent receiving
config error: mail loops back to me (MX problem?) errors, you need to add each
virtualdomain.tld to the
/etc/mail/local-host-names file and re-compile your sendmail config via
You have asked mail 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 recognise itself as domain.net. Add domain.net to /etc/mail/local-host-names known as /etc/sendmail.cw prior to version 8.10 or add "Cw domain.net" to your configuration file.
Perform the following to enable email forwarding from the virtual domain
virtualdomain.tld to another email address (in this example, email@example.com). There are no local accounts associated - the aliases file has been left untouched.
Note that the
hostname of the system this was performed on is different to
virtualdomain.tld; typically, this should be the case for you as well (that's the whole point of virtual hosts;
default will be bound to whatever VPS provided access domain defined in
# Hosts with to allow relaying virtualdomain.tld RELAY
", Addr=" clauses to receive from any interface. Do this with caution as this opens up your MTA to be abused by spammers if you're not careful.
/etc/mail/access needs to be setup carefully to ensure it rejects any domains apart from your own.
dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp')dnl
Add the following
dnl # Define virtualusertable FEATURE(`virtusertable', `hash /etc/mail/virtusertable')dnl VIRTUSER_DOMAIN_FILE(`/etc/mail/virtual-domains')dnl
virtusertable and add
/etc/init.d/sendmail reload to restart the daemon. You can debug the relaying action by watching the log file by doing
tail -f /var/log/mail.log.