Wednesday, March 27, 2013
Conditional always_bcc only for outgoing messages
Sometimes there is a need to clone all outgoing or incoming message traffic and forward it to specific mailbox. When using Postfix always_bcc configuration parameter can be used, with Sendmail external milter is needed.
Solution for Postfix have pros and cons, as it name says it will add BCC sender to ALL emails without exception, you cannot specify certain mailboxes or monitor only outgoing messages. It will even match bounce messages.
If you need add blind carbon copy per domain or skip specific e-mail address you need to use third party milter. With MSH Traffic Policy automatic bcc based on rules is easier than you think.
For our example I will assume than our internal domain is domain.net. This will let us to create rule which will behave like conditional always_bcc functionality.
Create new rule and begin with Add Envelope Recipient action. This will work as "add bcc recipient" because we will not add BCC header to message, so it will only have envelope recipient, which is not visible to the end recipient.
Provide email address for mailbox to which you want to forward all messages.
Next you need conditions which will match messages. On Conditions tab select from Add button Message Sender condition.
For our scenario we assume that we want to add BCC recipient to all outgoing messages.
Use name of your domain, so to each message which will have sender from domain.net BCC will be added (with firstname.lastname@example.org email address with our example).
Good idea is to exclude email address which receive all messages, so on Exceptions tab add Message Sender exception and provide email@example.com address.
On Name page provide name for you rule, i.e always_bcc, click OK button.
Save All settings on main application window.
See all conditions which have MSH Traffic Policy, because with them you can create sophisticated rules which match any messages you want: with certain attachments, specific subject or message size.