Saturday, February 2, 2013

Change subject for specified email recipient - Postfix/Sendmail



There is many ways to modify the message subject in Postfix and Sendmail based on message recipient, but the simplest way is to use milter MSH Traffic Policy. This software can do a lot of more than change and rewrite subject, you can: take care of attachments, block spam, manage MIME headers and many more.

So lets see how to create simple rule to modify message subject.

1. Add new rule by clicking Add Rule button.

2. When rule wizard will open, on Actions tab click Add button and choose from menu Modify Message Subject position.

3. Define new subject for the message. To insert old message use $SUBJECT variable.

4. If we want to rewrite subject only for one user then on Conditions tab click Add button and choose Message Recipient position.


5.Enter recipient email address (like john.doe@host.local) and choose in which field to search for this recipient. We want to change message subject when our defined recipient is in TO or CC field. So choose from combo box "in TO and CC field" position.
6. On Name tab define name for new rule, ie. Rewrite subject for user john.doe@sendmail.local and then click OK button.

7. When you create new rule click Save All button and you are ready to test your configuration.


To learn more visit MSH Traffic Policy website.