MBF Knowledge Base

I have two SMTP servers listening on ports 2525 and 2526. I have only 1 public IP address. I want Postfix to receive emails only for domain xxx.example.com and domain yyy.example.com then redirect those emails to server 1 (port 2525) for domain xxx.example.com and server 2 (port 2526) for domain yyy.example.com. How do I accomplish this?

Your main.cf should look like this:

#/etc/postfix/main.cf
mydomain = example.com
mydestination = xxx.example.com, yyy.example.com
relay_domains =
transport_maps = hash:/etc/postfix/transport
local_recipient_maps = hash:/etc/postfix/local_users


Also add the following files:

#/etc/postfix/local_users
# Here ACCEPT can be anything,postfix doesn't use it.
someuser@xxx.example.com ACCEPT
someuser@yyy.example.com ACCEPT

#/etc/postfix/transport
xxx.example.com   smtp:[localhost]:2525
yyy.example.com   smtp:[localhost]:2526
# modify localhost, if the server1 and server2 is not on localhost

Note: If this does not work, you may need to remove the email prefix (before @) in /etc/postfix/local_users. This will allow it to act as a wildcard. Also, you may have to change "localhost" to 127.0.0.1.