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

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

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

READ  How to Enable Logging for Email Subject Fields in Postfix Maillog

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
250-SIZE 10240000
250 DSN
mail from:root@ehowstuff.local
250 2.1.0 Ok
rcpt to:root@ehowstuff.local
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.

One comment on “How to setup Postfix Transport to Route the email messages

  • Jeevan Anto

    ehowstuff.local smtp:[] should be ehowstuff.local smtp:[]:25

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>