Search code examples
procmail

"OR" rules in .procmailrc with body search


According to http://lipas.uwasa.fi/~ts/info/proctips.html#orrules , you can make basic "or" rules in .procmailrc with something like:

:0:
* ^From:.*reriksso@([-a-z0-9_]+\.)*helsinki\.fi|\
  ^From:.*era@iki\.fi
${DEFAULT}

Normally, you can make a condition checks the body with a condition like

* B ?? search_body_for_this

However, this overrides the default header/body search area, so I can't do something like

* B ?? search_body_for_this|\
  ^From:.*example@example\.com

Is there any way I can do "or" rules as conditions that have sub-conditions that search the body and headers separately?


Solution

  • Actually I misinterpreted your question the first time...

    But if I understand you correctly than the solution would be to create two successive rules and using flag E (else if)

    :0 H
    * <header condition>
    <action>
    
    :0 EB
    * <body condition>
    <action>
    

    (Header flag set for documentation to explicitly state the purpose of the rule.)

    Nontheless, my previous answer might contain something new to you so I just leave it be:

    I don't know about your solution, but you can make OR-Rules by using weights

    :0
    * 1^1 some expression
    * 1^1 some other expression
    /some/destination