Postfix Gateway with blind carbon copy Multiplicator


Here is an exotic postfix gateway feature I did. It shows how to setup bcc copy with multiple recipients.

Here is an exotic Postfix gateway feature I did. It shows how to setup bcc copy with multiple recipients, while sending to an internal mailserver via a smtp transport.

Some advanced mail admins might wonder about the following lines, so here is the short story what real world scenario was solved with it.

First Postfix was choosen as a typical excellent antispam/antivirus gateway for one internal mailsystem with one maildomain. Over time the customer company absorbed many other companies and renamed them to departments with similar maildomain names leaving existing mailservers at their outside offices in action as a temp solution. Emails to their main maildomain should be passed to their head quarter and cloned to outside departments. So traveling mailusers should have their mails in every office. I only show the clone part here.

Building the multiplicator

Absolutely usual at gateways first declare which domains are allowed in

relay_domains =  hash:/etc/postfix/relay_domains

In this example relay_domains contains the following domain:        OK

Then declare allowed email addresses using relay_recipients in

relay_recipient_maps = hash:/etc/postfix/relay_recipients

The relay_recipients table contains the following entries:    OK     OK    OK

Now here's the trick. Put these recipients into a virtual_alias' map. First tell Postfix about the map in `

virtual_alias_maps = hash:/etc/postfix/virtual_alias

The recipients in a virtual_alias map are:

Now tell Postfix to BDD to the virtual aliases. Again tell Postfix about the map in

recipient_bcc_maps = hash:/etc/postfix/recipient_bcc

Then fill the map with re-routings to the virtual aliases:

Finally create the transport towards the internal mailserver in

transport_maps = hash:/etc/postfix/transport

My example map specifies the following routing:    smtp:


You can't specify multiple recipients in the right hand side of the recipient_bcc_maps, so i had to go this way.

Robert Schetterer, 04. May 2015