Friday, October 2, 2009

Episode 12: How do I configure sendmail to route mail to specific hosts?

This can be accomplished by adding appropriate entries to the /etc/mail/mailertable file. This file allows you to specify a domain, and where you want all email for that domain sent to. In the example below, all email destined for mydomain.com will be automatically forwarded to a mail server that resolves to backend.mail.server. Additionally, all email received from the 192.0.0.0 network will be forwarded to a mail server that resolves to outbound.mail.server.


Example:



/etc/mail/mailertable



mydomain.com smtp:backend.mail.server
192. smtp:outgoing.mail.server



After your modifications to /etc/mail/mailertable are complete you will need to run the following command:



makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable

Then restart sendmail: service sendmail restart

No comments:

Post a Comment