HowTo: bcc all recieved or sent mail from your postfix server
Postfix has the option to bcc all sent or recieved emails for a specific domain.
You can bcc all recieved mails for a specific by inserting the following in to /etc/postfix/main.cf :
recipient_bcc_map = pcre:/etc/postfix/bcc_recipient
then edit the file /etc/postfix/bcc_recipient and add your domain like this :
/(.*)@(example.com)/ backup@example.com
then at the console type postmap /etc/postfix/bcc_recipient to load the bcc recipients database. This will create the file /etc/postfix/bcc_recipient.pcre which is the database for bcc recipients.
Run postfix reload to insert the new options in postfix’s config. Now all the e-mails for example.com will be automatically bcc-ed to backup@example.com
______________
If you want to bcc al sent e-mails from a specific domain do the following :
Insert the following into /etc/postfix/main.cf :
sender_bcc_map = pcre:/etc/postfix/bcc_sender
then edit the file /etc/postfix/bcc_sender and add your domain like this :
/(.*)@(example.com)/ backup@example.com
then at the console type postmap /etc/postfix/bcc_sender to load the bcc senderdatabase. This will create the file /etc/postfix/bcc_sender.pcre which is the database for bcc senders.
Run postfix reload to insert the new options in postfix’s config. Now every e-mail sent from example.com will get bcc-ed to backup@example.com

Leave a Reply