procmail
[Top] [All Lists]

Re: counting recipients

2005-03-01 11:01:06
On Tue, Mar 01, 2005 at 05:53:21PM +0100, Ruud H.G. van Tol wrote:
I remember several comma-counting recipes, but I just
received a message that tries to be clever:

To: duh(_dot_)nicko(_at_)kriho(_dot_)com, 
dbd(_at_)gatekeeper(_dot_)vic(_dot_)com, smeagol(_at_)nokey-net(_dot_)net,
        rescyou(_at_)spro(_dot_)net, scouvrette(_at_)bluemarble(_dot_)net, 
yoof(_at_)jwgh(_dot_)org
To: notr(_at_)bestweb(_dot_)net, barbara(_at_)bookpro(_dot_)com, 
ericboesch(_at_)hotmail(_dot_)com,
        wretch(_at_)eris(_dot_)io(_dot_)com, 
beelzibub1(_at_)comcast(_dot_)net, nickb(_at_)fnord(_dot_)io(_dot_)com
<10 To: headers snipped>
To: tw(_at_)xs4all(_dot_)nl, noemata(_at_)kunst(_dot_)no,
johnny_bravo(_at_)kools-online(_dot_)com(_dot_)invalid,
        news(_at_)kools-online(_dot_)com(_dot_)invalid, 
geen(_at_)mail(_dot_)invalid

  LINEBUF = '32768'
  :0
  * ^^\/
  *  1^1 ^To:
  * -1^0
  *  1^0 ()\/(^To:.*)+
  *  1^1 MATCH ?? ,
  * ^^\/
  *  1^1 ^Cc:
  * -1^0
  *  1^0 ()\/(^Cc:.*)+
  *  1^1 MATCH ?? ,
  { } H_ToCc_count = "$="


Hmm.  I've long ago seen that with Cc:, but not with To:.
For Cc:, it was so prevalent three years ago that my recipe
for finding the Cc: line(s) takes it into account.  Here is
that recipe, with Cc: changed to To:

 :0  # 030104 () find and save value of To:(s)
  * $ ^To:.*\/[^$WS].*(^To:.*)*
  { TO = $MATCH }

Then I just count @'s in the $TO and $CC headers.

     :0  # 030104 () count @'s in To: and Cc:
      * 1^1  TO  ??  @
      * 1^1  CC  ??  @
      { ATCOUNT = $= }

-- 
dman

____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>