Rewrite message subject based on recipient


Some time ago user had a problem because his company switched to a new email-to-fax service. They had a security implementation that require to append to each email sent to them a fax number. Number must be added at the beginning of the message subject. He wanted to automate this step so users don’t need to remember and manually add number to subject.

So the requirement is that messages which are sent to must have subject in format:

123-555-789: Message subject.

Where Message subject is an original message subject before modifications and 123-555-789 is a fax number.


We need to create a rule with Message Recipient condition and Modify Message action.

  • Go to [Server] > Rules > Default Rules and click Add Rule button.
  • In new opened window, go to Actions tab and click Add button, choose Modify Message Subject menu.
  • Now define how subject will look like after rewrite. Based on our requirement is should be in 123-555-789: $SUBJECT format. Were $SUBJECT is a value which will be replaced with message subject.
  • Go to Conditions page and click Add button, select Message Recipient menu.
  • Enter a recipient email address: Select in which fields address will be searched.
  • On the Name page set a rule name, it should be a name which briefly describe actions made by this rule, for example: Modify subject for fax service.
  • Click OK button, then Save All to save current settings.

Rule wizard provide many variations of actions, ie. Modify Message Subject.


Now when someone will send a message to fax service email address to the message subject fax number will be added.

To learn more visit MSH Traffic Policy website.

Łukasz is a software developer and owner of MSH Software company which builds email processing tools for Microsoft Exchange, Zimbra Collaboration Suite and Postfix. He specializes in server, desktop and web applications written in Java, .NET and C++.