I am trying to do both of the following actions. However Postfix only changes the first Message-Id. With this example Precedence: bulk won't be added because it's at the bottom.

/^Message-Id:\s+<(.*?)@www.find.com>/   REPLACE Message-Id: <$1@www.replacewith.com>
/^Message-ID:/i PREPEND Precedence: bulk

How can I force postfix to do both of these? Or is it possible to combine them into one check?


Unfortunately it's not possible to have multiple rules fire for a single header. Wietse Venema's confirmation:

As documented, only one rule can fire per line. http://www.postfix.org/header_checks.5.html

As documented, use an external content filter for complex actions. http://www.postfix.org/BUILTIN_FILTER_README.html#limitations

Aside: I'm surprised the Message-ID check works, as according to the the header_checks manual page:


Message headers added by the cleanup(8) daemon itself are excluded from inspection. Examples of such message headers are From:, To:, Message-ID:, Date:.

Can you perhaps match on a different header and use that?

  • Message-ID does work, it already changes from find.com to replacewith.com and if I put the bulk on top that will work but then the find.com won't. – Teddy291 Jul 13 '15 at 12:14
  • Thank you for your help. I have just put the second change in front of MIME-Version. – Teddy291 Jul 13 '15 at 14:56

You can use two header_checks lines in the main.cf file and then define the check in two different files.

This doesn't scale to 100 headers, but i guess for your problem its useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.