Friday 4 October 2013

Using "Mailertable" force Sendmail to route mail to specific hosts or mailserver

Mailertable allows you to route or deliver mail to different hosts. You need to use feature called FEATURE(`mailertable') and you will have to create an external database containing the routing information for various domains.
First include mailertable feature you need to edit your sendmail.mc file and add the following line:
FEATURE(`mailertable'):

Open sendmail config file using text editor:
# vi /etc/mail/sendmail.mc
Append/modify line as follows:
FEATURE(`mailertable')
Regenerate sendmail configuration file using m4:
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Restart Sendmail service:
# /etc/init.d/sendmail restart
Open /etc/mail/mailertable file and add domain name to route to different hosts. For example all mail coming from network 192.168 route to mail.myisp.com and all email for test.in will be automatically forwarded to a mail server mail.example.com.
# vi /etc/mail/mailertable
Append following lines:
192.168. smtp:mail.myisp.com
test.in smtp:mail.example.com
Now build database version of the mailertable is built using:

# makemap hash /etc/mail/mailertable Or just type make command to build new mailertable.db file.

No comments:

Post a Comment