How to send an BCC copy of every incoming and outgoing email to another account? This is fairly simple to do with postfix. First open you main.cf and add or edit following lines:
# vim /etc/postfix/main.cf
now add these two lines:
sender_bcc_maps = regexp:/etc/postfix/archive_domain
recipient_bcc_maps = regexp:/etc/postfix/archive_domain
just a small explanation:
sender_bcc_maps is a regex based text file containing the mapping for outgoing mail
recipient_bcc_maps is a regex based text file containing the mappings for incoming mail
and here is an example line in the archive_domain file:
/^([^@]+)\@example\.com$/ $1@archive.example.com
the above line explained: every user @example.com will have a BCC copy send to that user @archive.example.com