How to create Procmail filter that checks both headers and body

You need both H and B if you want to match headers and body. See the Procmail Tips page, full of useful examples. Try

:0 HB
* ^From:.*[email protected]
* ^Subject:.*fixed string in the subject line
* fixed string in the body
/dev/null

(note, the above doc refers to a bug in version 3.22 whereby once HB is used further uses of just B will still look through H).


:0
* ^From:.*[email protected]
* ^Subject:.*fixed string in the subject line
* B ?? fixed string in the body
/dev/null

man procmailrc

variablename ??
Match the remainder of this condition against the value of this environment variable (which cannot be a pseudo variable). A special case is if variablename is equal to B, H, HB or BH; this merely overrides the default header/body search area defined by the initial flags on this recipe.

Tags:

Email

Procmail