Question : Postfix backup or archieve all emails

I needed to archieve / backup all emails that is coming and going into our mailboxes (multiple virtual domains and users).
We will be using postfix for the mail server.

What I want to achieve is very similiar to:
http://www.experts-exchange.com/OS/Linux/Q_21868508.html?sfQueryTermInfo=1+bcc+postfix

My questions are:

1. If possible, I wanted to know if we can direct all received emails to INBOX and all sent emails to SENT box of 1 account (say [email protected])

2. how would I go about using mysql instead of hash with the sender_bcc and recipent_bcc mapping? I'm not very good with mysql. Can you please help me with the query I need to put in the sender_bcc.cf and recipent_bcc.cf?

3. Noticed that in the above mentioned post, the file is saved as "/etc/postfix/sender_bcc". Do I need append the suffix ".cf" to the sender_bcc file?

4. I dont really understand the difference between sender & recipient_bcc versus "always_bcc". Is always_bcc better for my situation?

5. The manual at http://www.postfix.org/ADDRESS_REWRITING_README.html#auto_bcc says that "After applying the canonical and masquerade mappings...". Does it mean I have to perform the canonical & masquerade mappings before using the bcc function?

Thank You so much for helping

Answer : Postfix backup or archieve all emails

1. Impossible with postfix only. There is possibility to achieve this with for example procmail. Set always_bcc to some address, and configure procmail on this account. Procmail configuration won't be trivial in my opinion - you need to recognize somehow which email was received and which one was sent by your server. You may try to use something like below, but I cannot guarantee that it will work in every possible situation.
:0:
* ^From.*(your_domain1|your_domain2|your_domain3|...)
path/to/SENT

:0:
* ^To.*(your_domain1|your_domain2|your_domain3|...)
path/to/INBOX

:0:
path/to/some/other/box

The last one is for catching emails which didn't match first two rules - just for safety. There is possibility, that you will have tune first two rules a little to catch all proper emails.

2. You don't need mysql here, as sender_bcc_maps and recipient_bcc_maps are not the ones you are looking for. They are for specifying which emails (from which sender and/or recipient) are supposed to be copied to your 'backup' mailbox. As you want to copy all emails, you don't need to provide specific addresses.

3. The same as previous - you don't need sender_bcc_maps. But generally - this is just file. You may name it whatever you want. In above example - you don't need to add .cf extension.

4. always_bcc is better. My explanation is in answer for your 2nd question.

5. You don't have to. It's just information, that if you have some canonical/masquerade mappings, they will be applied before copying emails due to always_bcc option.
Random Solutions  
 
programming4us programming4us