Copyright (c) 2011, Michael de Silva ([email protected]) Blog: http://www.bsodmike.com ~ Twitter: @bsodmike
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 make
.
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] (if you are using FEATURE(`use_cw_file')) or add "Cw domain.net" to your configuration file.
Source: http://www.sendmail.com/sm/open_source/support/support_faq/general_issues_faq/#4.5
Perform the following to enable email forwarding from the virtual domain virtualdomain.tld
to another email address (in this example, [email protected]). 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 hostname
).
# Hosts with to allow relaying
virtualdomain.tld RELAY
Remove ", 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
Create virtusertable
and add
[email protected] [email protected]
Perform make
and /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
.