I want postfix to log the 'From' Header, and maybe other headers from the email content (not the Envelope header) in order to assess DMARC domain alignment in outgoing email.
I know about using header_checks
with a WARN
action, but I have other header_checks rules, and it's hard to avoid conflicts this way.
What other options are there?
You could write a milter in the language of your choice, and pass your mail through it to obtain that information.
If you need log header info from Postfix, then you may visit postfix doc about Content inspection overview. That page states that there are four option to do content inspection
Built-in Content Inspection (before queue, built-in, light-weight)
This option was including header_checks and body_checks. Just declare simple regex and you are done. Unfortunately, as you said above this one has disadvantage because they may interfere with other header_checks.
After-Queue Content Filter (after queue, external, heavy-weight)
This option may force you learn some programming language to do the job. You can get the email from postfix via SMTP or pipe. See the docs for some examples. This one can called independently with another checks.
Before-queue content filter
This option may force you learn some programming language to do the job. Postfix talk to this content filter with SMTP. If you don't, you can use Bennett Todd's SMTP proxy that implements a nice PERL/SMTP content filtering framework. See: http://bent.latency.net/smtpprox/. This one can called independently with another checks.
Before-queue Milter applications (before queue, external, medium-weight)
This option same as NickW suggestion. You need to understand milter protocol and implement it in some programming language. This one can called independently with another checks.