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:
# vi /etc/mail/sendmail.mc
FEATURE(`mailertable’) <- enable this line
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
# service 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.1 route to mail.myserver.com and all email for kvit.in will be automatically forwarded to a mail server mx.kvit.in
# vi /etc/mail/mailertable
Now build database version of the mailertable is built using:
# makemap hash /etc/mail/mailertable or
to update mailertable.db
Case : Suppose we need to relay mails for one domain only. if anyone send mails to any said domain to be captured to a said Email-Id.
hare at above case all mails to hsbc.co.in,citi.com,yahoo.com will relay properly, if anyone send mail to any .com domain will be captured to email id email@example.com.
Split Domain in Sendmail Using luser_relay
What is split domain ?
Divide Email Users (same domain user, linuxgateway.in here as an example ) in more then one server. by default sendmail rejects or bounced mails for unknown local users. if we enable LUSER_RELAY feature, then sendmail search unknown local users into given server (mail.linuxgateway.in here) . Note that
mail1.linuxgateway.in <– our local Sendmail Server (188.8.131.52)
mail.linuxgateway.in <— remote Server (184.108.40.206)
Here some users exists on mail1.linuxgateway.in and others users exists on mail.linuxgateway.in, all users has email id having @linuxgateway.in.
search for text special local and modify as given below
$#_LOCAL_ $@ $2 $: @ $1
$#_LOCAL_ $@ $2 $: $1