How To Change SMTP Routes On Popular Mail Transport Agents (MTA)

Once in a while you may need to change the SMTP IP destination of your mail relayer server. Last month our company installed a new anti-Spam software using Symantec Mail Security to reduce the significant number of incoming spam email. During this project test and deployment period I need to change the email smtp routes several times. Here I created the documented steps that I did during the process.

Just one comment about the Symantec Mail Security Anti-Spam feature. It is very good software that can help you reduce 99.9% of spam emails. It is 99% accurate in keeping the spam email from going to your inbox. Until now I only receive 1 spam email for the whole two weeks. However it needs to update its database every 20 minutes or less. And this update can take up to 4 GB of internet bandwidth every week. Well, that’s quite a price for keeping spam email out of your email huh!

Allright, back to how to change the SMTP routes of three most popular MTA (sorry, I don’t include Exim cause I didn’t able to tried it..)

In Sendmail:

Step 1. Login as root
Step 2. Find the file mailertable. Usually its in the directory /etc/mail, if it isn’t, search with the find command: #find / -name mailertable
Step 3. Edit the file as neccessary. Follow the following format:

domain.com 192.168.100.100
sub.domain.com 192.168.100.101

Step 4. Compile the mailertable file with the following command: #makemap mailertable

In Postfix:

Step 1. Login as root
Step 2. Find the file transport. Usually its in the /etc/postfix, if it isn’t, search with the following command: #find / -name transport
Step 3. Edit the file as neccessary with vi or other text editor. Follow the following format:

domain.com 192.168.100.100
sub.domain.com 192.168.100.101

Step 4. Compile the transport file with the following command: #postmap transport

In Qmail:

Step 1. Login as root
Step 2. Find the file smtproutes. Since qmail directory structures is quite confusing compared with Sendmail and Postfix, I stongly suggest you to use the find command: #find / -name smtproutes
Step 3. Edit the file as neccessary. Follow the following format:

domain.com smtp:192.168.100.100
sub.domain.com smtp:192.168.100.101

Step 4. Restart the server ( I tried to restart the service, but it didn’t change. Even worse, it stops forwarding email to the SMTP destination.)

Author: Trijito Santoso

I’m Trijito Santoso, a Seventh-Day Adventist, a medical technology and computer science graduate, and a software developer. The reason why I shifted from medical technology to computer science is because I love to create things (design, software, articles, anything), and being a software developer allows me to create things everyday. I graduated from Northeastern University, Boston, with a degree Master of Science in Computer Science. My resume is available on my LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *