How to setup Postfix Transport to Route the email messages

This post will show you how to route messages to other mail server using postfix transport file. This feature allows you to perform mail routing to respective host according to the map defined. Postfix will checking the transport map first instead of reading the DNS for MX record. The steps was tested on CentOS 6.5 and Postfix 2.6.6.

1. In order for Postfix to use the transport file, configure main.cf to use transport map :

vi /etc/postfix/main.cf

Append the following at the bottom :

transport_maps = hash:/etc/postfix/transport

2. Edit transport map file :

vi /etc/postfix/transport

Append the following at the bottom :

ehowstuff.local           smtp:[192.168.0.2]

3. Rebuild the transport database file :

[root@mx-mx06 ~]# postmap /etc/postfix/transport

Note : The command “postmap /etc/postfix/transport” should be execute whenever you change the transport table.

See also  How to Upgrade Zimbra Collaboration Suite 8.0.6 to 8.0.7 on CentOS 6.5 x86_64

4. Reload postfix to apply the new transport :

[root@mx-mx06 ~]# postfix reload
postfix/postfix-script: refreshing the Postfix mail system

5. Verify :

[root@mx-mx06 ~]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mx.ehowstuff.local ESMTP Postfix
ehlo abc.com
250-mx.ehowstuff.local
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:root@ehowstuff.local
250 2.1.0 Ok
rcpt to:root@ehowstuff.local
250 2.1.5 Ok
data
354 End data with .
.
250 2.0.0 Ok: queued as D02D861B50
quit
221 2.0.0 Bye
Connection closed by foreign host.

Comments

1 Comment

Leave a Reply to Jeevan Anto Cancel reply

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