procmail
[Top] [All Lists]

Re: Split (\/) regex with optional component on left

2009-12-16 17:35:14
At 16:37 2009-12-16 -0500, James Michael Fultz wrote:
:0
* ^(List-(Id|Post)|X-(Mailing-)?List):.*<(mailto:)?\/[^(_at_)(_dot_)]+
ML/$MATCH/

So far it works for all except one of the intended matches.  Headers
such as the following:

Have you taken a look at listname_id.rc ? Chances are, it'd just do what you need, without you needing to tweak.

List-Post: <mailto:listname(_at_)example(_dot_)com>

listname_id groks this properly.

...result in delivery to 'ML/mailto:listname' rather than 'ML/listname'.
I understand that using '\/' causes matching on the left to be stingy
which I suppose is causing the result I am getting.  Is a separate
recipe for List-Post the only viable option here?

listname_id uses scoring to allow one of several conditions to match and set a variable. There's a second recipe, which has an 'E'lse flag, which tries the Sender: header (which requires a bit more "cleanup") if the first series of conditions didn't match.

In my recipes, I don't deliver directly to a mailbox with the matched string, but I do get the listname, and with that I can make other determinations for filtering (bypass certain types of spam filters, etc) before delivering, because the other recipes can check for $LISTNAME being set or not (or against specific values - procmail list for example allows for more spammy bodies because we discuss spam stuff here a lot).


---
 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 homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail