Using Postfix Transport Maps for Email Address Specific Aliasing

January 31st, 2011

Postfix has terrific e-mail gateway capabilities, and yesterday I discovered a configuration option to select a mail transport based upon email address, rather than domain.

This is very desireable for me as it allows me to use my backup mail transfer servers to alias addresses within the domains they provide backup mx services for. This means if I want to alias an address to another off-network domain and the primary server is down, the backup mx agent can take can of it right there and then.

Now, onto the configuration specifics! Note: I use the postfix-cdb package for fast key-value pair hashing, and I also use relay_recipient_maps to specify the list of acceptable recipients on the gateway to prevent backscatter spam.

Postfix Transport Map Configuration for a Gateway Relay to Address Aliases Locally for Relayed Domains

Postfix transport_maps

The key configuration option is transport_maps:

transport_maps = cdb:/etc/postfix/maps/transport


Example transport mapping: local: relay:[]

In this example, is treated as a local address, and Postfix will check the alias_maps configuration option, while the rest of the acceptable addresses for will be relayed to

At first I found it odd that Postfix did not require to be specified in the mydestination directive, but just now I have concluded that transport_maps has the same effect, and it makes perfect sense to me.

For local aliasing, my configuration of Postfix is set in this way:

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

Example /etc/aliases


I haven't rolled this solution out to my backup MX servers, though I plan to do so once I test this solution out some more.

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022