Tuesday, May 21, 2013

How to forward certain emails to another mailbox

If you have scenario where you need to forward some messages based on something else than bare Postfix and Sendmail configuration, you need to use MSH Traffic Policy. It provide many conditions which can be used to match certain emails and skip those which not matters. Just a few what can be used:

  • Message sender, recipients and headers
  • Message recipients counts
  • Attachments name, type, size or count
  • Envelope sender and recipients
  • Based on message count


Simple step by step configuration

Create new rule clicking Add Rule button.

On Action tab click button Add and select Forward Message from many listed actions, see full list of actions.

When new window will open provide subject and recipient of forwarded message. In Subject field you can use advanced variables to distinguish message.

Now when action is defined go to Conditions tab and add Message Recipient condition. 

You can choose Wildcard or Regular expression pattern when matching message recipient. Search in option will let to match specified message headers: TO, CC, BCC.

Switch to Name tab and provide descriptive name for rule. Click OK button.

Now make sure you have enabled your new rule and click Save All button to persist settings. Now all emails which was originally sent to jake@server.local will be forwarded to dave@server.local.


Summary

This was simple configuration where messages could be forwarded based on specified domains, mailboxes, message header or event time range. 

Learn more about MSH Traffic Policy server side rules.