Wednesday, October 29, 2008

Cool Postfix Feature: recipient_bcc_maps

A client of mine had a request for all incoming e-mail to be both delivered to the recipients and copied to another e-mail of his choosing. He wanted this to keep a pulse on the e-mail traffic coming in to various accounts.

My first instinct was that this was going to require some tricky aliasing hackery. But, it turns out, postfix makes this really easy. It's all described in this article:

The idea here is that any email that is caught by Postfix and matches either a sender or recipient address is bcc'd to another account,

It works by setting up a config file with the people to apply this to:

 # recipient_bcc map
 mike  dave
 sarah dave
 greg  dave

Then, add the following setting to your postfix

 recipient_bcc_maps = hash:/etc/postfix/recipient_bcc

See the article for complete details to get this working.

Now, any mail for mike will be sent to him, and silently sent to dave.

This does exactly what my client wants. You could also use this setting to archive all sent mail by setting sender_bcc_maps. This might be a good way to archive messages offsite.

I have to say, I'm more and more impressed by postfix's capabilities.

1 comment: