Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I would like to know how to configure sendmail to only send emails to one domain.

I have a development server that might have customer email addresses in the database as the data is copied from the production server from time to time. I would like to make sure that the developement box (Redhat 5.3) does not send any mails externally but will send to my local users. For the sake of argument my domain is example.com and sendmail is currently set to relay mail to our SBS2008 exchange server.

So far I have not been able to find out how to do this.

share|improve this question

1 Answer 1

Try adding this in your sendmail.mc:

LOCAL_RULE_0
R$* < $=w . > $*     $#OK
R$* < $*. > $*       $: user < @ example.com. > $3

This modifies ruleset 0 (the one that selects how email is going to be routed) as follows: If this is a local mail address (the domain part is included in $=w) then proceed as usual. Else, send email for every external address to user@example.com.

When adding the above snippet in your sendmail.mc take care to NOT copy-paste the rules, but type them. The two sides of the rules are not space separated. They are separated by tabs (at least one; two or more do not make a difference).

After editing sendmail.mc you have to produce sendmail.cf and restart sendmail. I do not know how this is done in your distribution. In Debian I run sendmailconfig.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.