How to setup Postfix Transport to Route the email messages

Share this Article :

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 to use transport map :

vi /etc/postfix/

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:[]

3. Rebuild the transport database file :

[[email protected] ~]# postmap /etc/postfix/transport

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

Also Read :   Why I Choose HostGator rather than MERCUMAYA.NET Web Hosting?

4. Reload postfix to apply the new transport :

[[email protected] ~]# postfix reload
postfix/postfix-script: refreshing the Postfix mail system

5. Verify :

[[email protected] ~]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mx.ehowstuff.local ESMTP Postfix
250-SIZE 10240000
250 DSN
mail from:[email protected]
250 2.1.0 Ok
rcpt to:[email protected]
250 2.1.5 Ok
354 End data with .
250 2.0.0 Ok: queued as D02D861B50
221 2.0.0 Bye
Connection closed by foreign host.

Leave a Reply