Dec
23
2010
postfix & recipient bcc aka Automatic BCC recipients

I am supporting a greek company with two linux servers.
These two linux boxes have a lot of services,
including a mail server and they are set upped as active/passive.

In the past week they lost their internet adsl connection.
This is a true and horrible story, but for that i’ll write another post in near future.
So without an internet connection there werent a lot of things i’ve could do.

Thanks to Santa Claus i had predict this problem and i have installed a linux vps server outside of the company as a backup mx/mail server to queue all the undelivered mail.

From the company, i ‘ve been asked if i could keep all the mails in queue and also provide a copy to a gmail account. After google searching about postfix rewrite and re-queue i ‘ve came to automatic recipient bcc.

In my /etc/postfix/main.cf (or you can use postconf) i added this line:


recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc_maps

If you are a careful reader then you have noticed that i wrote regexp for my recipient map file.
And the reason is that i wanted to combine all the mails that came to the backup mx server.

This is my /etc/postfix/recipient_bcc_maps:


/@example.com/       example.com@gmail.com

Of course i had to reload postfix in the vps and send a test email to verify that the blind copy for all the domain is working.

If you want to re-queue all the mails then you have to do something like this:


postsuper -r ALL

PS: As the Journey have said: Don’t Stop Believing …. in Santa Claus
Have a nice holiday :)