sendmail only relaying messages bound for one specific domain

I was wondering if you could please help me with what could be a simple problem but i cant seem to figure it out.

We have a few centos servers running sendmail (all internal servers on the local lan)- with a very simplistic sendmail configuration (all default) except for a relay everything to our exchange server option i.e DSourexchangeserver Now what i want to do is have these centos servers sendmail configurations ONLY relay emails destined for our companys domain i.e [email protected] I do not want mail relayed to anywhere else. Is there anyway to get sendmail to check mails being passed to it and only relay ones on to our exchange server that meet the requirement of being destined for our companies domain and stop everything else ?


Solution 1:

See: http://www.sendmail.org/tips/relaying

The simplest approach is to list the domains you are willing to relay in the file /etc/mail/relay-domains. Anything listed in this file will be accepted for relaying. N.B.: Sendmail must be restarted after this file is modified.

This and other tips on that page should get you started. Otherwise, you may want to check into SMTP AUTH if you need to control who can relay email.