On Thu, Oct 09, 2003 at 11:07:43AM -0700, Bill Kendrick wrote:
> 
> I have Procmail entries like this one:
> 
> :0
> * ^To:(.*\<)[EMAIL PROTECTED]
> { TAG=[mysql] }
> 
> (where "TAG" is a little function to shove a string at the beginning
> of the subject line, much like what's done on MOST lists I subscribe
> to, like vox-* do here at LUGOD)
> 
> 
> However, as you can see, it only checks the "To:" line.
> Sometimes people reply to a poster, and then Cc the list.
> 
> I'm always afraid to play with my live .procmailrc file, and don't
> really have a 'test' environment (I'm sure someone'll explain an easy
> way to test stuff on the shell ;^) ), but would something like this
> work?
> 
> :0
> * ^(To:|Cc:)(.*\<)[EMAIL PROTECTED]
> { TAG=[mysql] }

Look at procmail's built-in TO macro. It catches To:, Cc:, Bcc:, and a
few other common ones. Then, that would be
* ^TO(.*\<)[EMAIL PROTECTED]

A more reliable way to match list posts is to look for a list-specific
header. I know that Mailman-based lists put a List-Id: header in any
messages that are sent out to the list, and ezmlm may do the same. Using
this kind of a header will even catch people that BCC the list or
don't have the list address in their headers for some other reason. 

For example, my procmailrc has the following recipe for vox: 
:0:
* ^List-Id:.*vox\.lists\.lugod\.org
lugod


> Man, I need to brush up on regexp I think ;)
> 
> Thx for helping a pitiful procmailer,
> 
> -bill!
> 
> -- 
> [EMAIL PROTECTED]                           Got kids?  Get Tux Paint! 
> http://newbreedsoftware.com/bill/       http://newbreedsoftware.com/tuxpaint/

-- 
Samuel Merritt
OpenPGP key is at http://meat.andcheese.org/~spam/spam_at_andcheese_dot_org.asc
Information about PGP can be found at http://www.mindspring.com/~aegreene/pgp/

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to