procmail
[Top] [All Lists]

Re: Recipe Questions

2002-08-20 13:28:37
From: "Brandon Rasler" <brandon(_at_)mennotrav(_dot_)com>

Do these two recipes do the same thing as the single recipe below?

:0 Hc
* ^Subject:.*Important: Windows Update
| /home/foo/trap.pl

:0 Hc
* ^Subject:.*Internet Security Update
| /home/foo/trap.pl

#Single recipe

:0 Hc
* ^Subject:.*Important: Windows Update
* ^Subject:.*Internet Security Update
| /home/foo/trap.pl


No.  The conditions are "ANDed," not "ORed."
Your last try says the mail would have to pass
both conditions to be shunted to your perl script.

Read "man procmailrc" and "man procmailex" for
ideas on how to put alternative conditions in one
recipe.  There are three basic approaches:

1) The classic egrep-style ORed condition:

 * ^Subject:.*I(mportant: Windows|nternet Security) Update


2) Use of scoring (man procmailsc) to do, visually, what
   you apparently had in mind:

 * 1^0 ^Subject:.*Important Windows Update
 * 1^0 ^Subject:.*Internet Security Update


3) The (very cool) "Reverse deMorgan" negation-of-negation trick,
   the understanding of which will be helped by some theory in logic:

 * ! ^Subject:.*Important Windows Update
 * ! ^Subject:.*Internet Security Update
 { }
 :0 E
 /home/foo/trap.pl


Btw, you may or may not want the `i' and `w' flags on the
recipe that feeds to the perl script.  See "man procmailrc"
and "man procmail".

Oh, and I don't think you need the H at all -- it's the
default egrep area.

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Recipe Questions, dman <=