procmail
[Top] [All Lists]

Re: Troubles with $MATCH

2003-12-09 10:06:24
At 10:14 2003-12-09 -0500, Birl wrote:

Using data such as   procmail(_at_)concept(_dot_)temple(_dot_)edu  or
sbirl+procmail(_at_)concept(_dot_)temple(_dot_)edu   and expecting $MATCH to 
return
'procmail'

FTR, since you explicitly declare something after the match operator '\/', that's going to be included in the match. You'll need to weed that out. One way is to have a second recipe within braces on the first, another is to have a plain condition check followed by a match (that leaves something to be desired), and yet another is to have a second condition line which makes use of the $MATCH which was set in the first.

# catch-all for email aliases
:0
#* ^(To|Cc):.*\/+(_at_)concept\(_dot_)
* ^(To|Cc):.*\/[^(_at_)]+@concept\.

Look for zero or more of anything and then after the match operator, one or more of anything that isn't an @, before matching the domain portion.

This is going to choke on the same multi-recipient addressing that I mention below. How about you give us some idea of what it is you WANT in $MATCH ?

* ^(To|Cc):.*\<\/[^@,   ]+(_at_)concept\(_dot_)

Note inclusion of comma (separator for multiple addresses) space and tab. Also note addition of the word-break \< before the match operator, so if there's multiple addressees, this SHOULD focus on just one of them, though no doubt there is room for significant improvement.

:0:
#* ^(To|Cc):.*sbirl\+\/[^(_at_)]@concept\.
#* ^(To|Cc):.*sbirl\+\/+(_at_)concept\(_dot_)
* ^(To|Cc):.*sbirl\+\/[^+]+(_at_)concept\(_dot_)

Shouldn't have two plusses anyway, but the filter there should reasonably catch something - though conceivably, it could be mussed up by:

Cc: user(_at_)domain(_dot_)tld, sbril+procmail(_at_)concept(_dot_)com, 
otheruser(_at_)concept(_dot_)com

# second condition uses the $MATCH set in the first and cleans it up.  Note
# use of + there instead of *.
:0
* ^(To|Cc):.*\<sbirl\+\/[^+@    ]+(_at_)concept\(_dot_)
* $MATCH ?? ()\/[^(_at_)]+
{
        LOG="we matched $MATCH${NL}"
}

Problem is simple, $MATCH turns up empty.

Immediate problem is that you're showing us procmail recipes, and you're showing that you're doing VERBOSE logging, but you don't provide any matching excerpts from the log, or an example of the To: and Cc: headers you're sending at the script.

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