procmail
[Top] [All Lists]

Re: MATCH

2001-10-18 02:42:44
On Wed, Oct 17, 2001 at 12:37:47AM -0500, Butch Evans wrote:
I have the following recipe:

:0

* ^Subject: pmtest|^Subject: 
cybr|^FROM(_dot_)*deliberatus(_at_)my995internet(_dot_)com

{
        :0f
        |formail -i "X-match: $MATCH">>$KILLEDBOX
}

Note that, tough there are the macros ^TO and ^TO_, there is is no ^FROM.

I suspect the regexp you have here isn't going to do what you think you want.
Reading this, I gather what you want is:

(variation 1)
If the messges headers have
        Subject: pmtest
OR
        Subject: cybr
OR
        From: deliberatus(_at_)my995internet(_dot_)com

Then your condition would be

* 
^(Subject:.*(pmtest|cybr)|From:(_dot_)*deliberatus(_at_)my995internet\(_dot_)com)

(variation 2)
If what you want to achieve is:

        From: deliberatus(_at_)my995internet(_dot_)com
AND 
        Subject: cybr OR pmtest

Than your condition is:

* ^From:(_dot_)*deliberatus(_at_)my995internet\(_dot_)com
* ^Subject:.*(pmtest|cybr)

I have read the man page, as well as Jari Aalto's tips page.  I am
just not getting how to construct the regex in order to get a value
for $MATCH.  I have tried: 
*
(^Subject: pmtest|^Subject: 
cybr|^FROM(_dot_)*deliberatus(_at_)my995internet(_dot_)com)\/.*

as well as other variations on the above theme.  Am I going to have
to put something like
^Subject: pmtest\/.*|^Subject: cybr\/.*|.......
in order to get it to work?  Any other suggestions where a
tips/example page speaks to a guy who wonders why regular
expressions are called "regular"?

Depends on what you want in $MATCH. Everything to the right of \/ in your
condition will be stuffed into $MATCH. I'm guessing based on the above that
you're looking for something like:

(variation 1)
* ^(Subject.*\/(pmtest|cybr)|From:.*\/deliberatus(_at_)my995internet\(_dot_)com)

(variation 2)
* ^From:(_dot_)*deliberatus(_at_)my995internet\(_dot_)com
* ^Subject:.*\/(pmtest|cybr)

Also, the above do not guaruntee $MATCH will be EXACTLY "pmtest" or "cybr" or
"deliberatus(_at_)my995internet(_dot_)com". Anything else following those 
strings within
the same header fields will also be in $MATCH, so you could get "pmtest foo
bar", "cybr foo bar" or "deliberatus(_at_)my995internet(_dot_)com>" (highly 
likely,
actually) or even 'deliberatus(_at_)my995internet(_dot_)com> "Foo Bar"' if 
deliberatus'
mailer is so inclined. The more "correct" way to extract the sender's address
involves the use of "formail -rz -xTo:", but be sure you understand the
implications of the difference between their Sender address and the address to
which replies should be sent, as well as what the presence of a Reply-To:
header field will do. (More accurate: read the procmail FAQ.)  

-- 
Andrew Edelstein        -       andrew(_at_)pure-chaos(_dot_)com
http://andrew.pure-chaos.com

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