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.

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s