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 nixcraft.com will be automatically forwarded to a mail server p5.mail4india.com:
# vi /etc/mail/mailertable
Append following lines:
192.168. smtp:mail.myisp.com
nixcraft.com smtp:p5.mail4india.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:
# make
See also:
- Using Mailertables Readme for more information.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 3 comments… read them below or add one }
I have a centos & I use sendmail as mail server.
In sendmail.cf I had put an IP Address of relay server. & All mail is sending properly but My mail server administrator told me to put host name instead of IP address in SmartHost Ds in sendmail.cf & I done it but I cant send mail to anybody & I got an error –
451 4.4.1 reply: read error from smtp.sss.in.
Please anybody tell me How can I send mail to outside via my relay using host name & what should I do?
How can we use the other port?
for example,use port 2525.
Hi there
Just add this line to sendmail.mc
DAEMON_OPTIONS(`Name=MTA2500,Port=2500)
and rebuild
//Martin