Thursday, August 6, 2009

RHCE Tips:How do I configure sendmail to route mail to specific hosts?

Sendmail is a popular mail server which comes by default with Red Hat Linux. For Ubuntu OS, you will have to install it through:
$sudo apt-get install sendmail

Wait and let machine do rest of the stuffs.

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.server192. 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 Restart sendmail: #service sendmail restart

Thats it. Now sendmail is ready to route your mail to specific hosts preventing other machines to receive the same.

Happy Mailing.

No comments:

Post a Comment