procmail
[Top] [All Lists]

Re: counting recipients

2005-03-01 12:05:26
Dallman Ross schreef:

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

I think you could safely change that to:

   * ()\/(^To:.*)+


  { TO = $MATCH }

If there is only an empty (or spacy) To:header, 
MATCH would remain as is, and TO would remain unset.
I guess that is OK in the context.


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 = $= }


Rewriting mine to count the @'s:

  LINEBUF = '32768'

  :0
  * ^^\/
  * -1^0 ^To:
  *  1^0 ()\/(^To:.*)+
  *  1^1 MATCH ?? @
  * ^^\/
  * -1^0 ^Cc:
  *  1^0 ()\/(^Cc:.*)+
  *  1^1 MATCH ?? @
  { } H_ToCC_count = "$="


The embedded tricks are: 
- inline unsetting of MATCH
- works also when To- or Cc-header empty or missing
- no tempvars


The next spammer's trick will of course be to interleave some To: 
and Cc: headers, sprinkled with X-whatever headers.

-- 
Grtz, Ruud

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