Postfix: Archiving Mail when sent from or to the outside world

The goal here is to send an BCC message for every email send to or from the outside world, for a group of internal addresses.

Use sender_bcc_maps or recipient_bcc_maps. Configure them so that the archive copy is made when the sender is remote OR the receiver is remote.

/etc/postfix/main.cf:

sender_bcc_maps = pcre:/etc/postfix/archive-check
recipient_bcc_maps = pcre:/etc/postfix/archive-check

/etc/postfix/archive-check:

!/@example.com$/        archive@example.com

This is a predicate transformation, from (NOT (local AND local)), what you asked for, into ((NOT local) OR (NOT local)), shown above.

One thought on “Postfix: Archiving Mail when sent from or to the outside world

Leave a Reply