Redirect e-mails in postfix based on subject line

Depending on your situation, it may be handy to redirect e-mails that have a certain subject line before it even reaches a user's inbox. Let's say you're tired of getting e-mails that start with the word "Cialis". Just follow these steps to redirect those e-mails.

First, enable header checks in /etc/postfix/main.cf:

header_checks = regexp:/etc/postfix/header_checks

Then, create /etc/postfix/header_checks and add the following:

/^Subject: Jobs*/
REDIRECT someotheruser@domain.com

For a lot more information about header checks in postfix, review the documentation here:

http://www.postfix.org/header_checks.5.html

Printed from: http://rackerhacker.com/2007/07/01/redirect-e-mails-in-postfix-based-on-subject-line/ .
© Major Hayden 2012.

Leave a Reply

 

  • Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you find the information useful. If you spot something that's incorrect or confusing, please write a comment and let me know. Drop me a line if there's something you want to know more about and I'll do my best to write a post on the topic.
    -- Major Hayden

    Flattr this