Sendmail local domain is hosted externally e-mail fails :(

sendmail

I have sendmail which works great sending to external domains, but for its own internal domain it tries to deliver mail locally instead of externally based on the MX records. Is there a way to fix this?

I have looked at other posts, but haven't been able to figure it out.

Best Answer

I think you may benefit from "nullclient" configuration of sendmail. Just put the following in your /etc/mail/sendmail.mc:

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`nullclient setup')dnl
OSTYPE(`linux')dnl
FEATURE(`nullclient',`your.mail.server.address.or.name')dnl

It will forward everything to an external mail server except mail addressed to 'root' (at least this is how it works on Centos).