procmail
[Top] [All Lists]

Re: If VARIABLE = (this|orthis|orthat)

2001-11-28 12:02:58
At 11:35 2001-11-28 -0500, Timothy J. Luoma wrote:

If REPLYTO = any of those 3, then I want to put the message into a special
folder

:0:
* REPLYTO ?? 
(\<|^)(joe(_at_)aol\(_dot_)com|ed(_at_)msn\(_dot_)com|john(_at_)yahoo\(_dot_)com)(\>|$)
friends.mbx

Those escaped brackets are WORD delimiters, not literal brackets, as per 'man procmailrc'. This word separation stuff suffers the same fault as the grep invocation below (though here, you could roll out the regexp macro and add other symbols to the exclusion list such as dot and underscore). Since the particular formail construct of obtaining the envelope From_ should result in a raw address, you're pretty safe just matching it against the address list. However, if you wrap the address list as above, you should be able to catch specific addresses say if you decide to use the From: header instead (where the result provided by formail may include other identifying text from the From: line).


I keep the addresses in a separate file (it is easier to administer them), one per line, no divider symbols (well, the newline serves as that - but no ors, commas, etc), and the following is functionally similar to what I use for several address group filters:

:0:
* ? formail -xFrom: | fgrep -i -w -f $PMDIR/friends.dat
friends.mbx


Note that this matches the friends text within the From: text (not your replyto), and grep expects the text on stdin (rather than as a commandline argument) - this is necessary because the from text itself may contain other crud surrounding the address (but the use of -w helps assure us that we don't match say "gfisher(_at_)somewhere(_dot_)com" when we have "fisher(_at_)somewhere(_dot_)com" in our list -- otoh, g.fisher _would_ match, and that's just something I accept (but haven't run into).

If you have the text already assigned to a variable, using the grep functionality above would necessitate echoing the text:

* ? echo $REPLYTO | fgrep -i -w -f $PMDIR/friends.dat


I hope this is something like what you were looking for.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
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>