procmail
[Top] [All Lists]

Re: How do you 'OR' conditions

1995-12-21 17:46:35
As the condition lines are ANDED, is there an elegant
solution to OR them?

Use weighted scoring:

    :0:
    * -1^0
    *  1^0 ^To:(_dot_)*procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
    *  1^0 ^Cc:(_dot_)*procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
    procmail

Notes:

1. no need to reference $MAILDIR; it is implicitly referenced with
   relative file names.

2. no need to name a lockfile (one is implied with a trailing ":")

3. use "f" flag *only* with pipe filters, "| $COMMAND $ARGS ...", not
   files.  Similarly, "w" isn't necessary with files; it seems only
   useful for pipes.

4. "i" is a bad idea on writes to files, if you wish to be able to
   provide "error" case recipes:

    :0:
    * -1^0
    *  1^0 ^To:(_dot_)*procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
    *  1^0 ^Cc:(_dot_)*procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
    procmail
    
      # Handle write failures carefully, try another filesystem, which
      # might not be full, or offline.
      :0e:
      /alt/mailspool/$LOGNAME/procmail

      # One more time
      :0e:
      $DEFAULT

4. matching is case-insensitive, unless the "D" flag is given.


I want to save all files from this email group to a file
that I can retrieve remotely, or read seperately. The emails to
this group have different headers. I want to be able to run
the following recipe, but OR the conditions:

# Put all procmail information into procmail mailbox.
:0fwi:$MAILDIR/.lock
* ^To(_dot_)*procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
* ^Cc(_dot_)*procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE
$MAILDIR/procmail

In this case, you can simply OR the "To:" and "Cc:" with:

    :0:
    * ^(To|Cc):(_dot_)*procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
    procmail

But why not do this:

    :0:
    * ^TOprocmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
    procmail

The ^TO macro handles a reception address by all the receiver headers.

Alan

<Prev in Thread] Current Thread [Next in Thread>