procmail
[Top] [All Lists]

Re: Filtering on the cc line size

1996-04-10 16:32:56
Philip Guenther suggested to wotan(_at_)netcom(_dot_)com, who had asked:

| >Is there a way to test the cc line and filter out mail if the line has an 
| >unreasonable number of characters in it?  
| 
| :0
| * ^Cc: \/.*
| * MATCH ?? > 200
| /dev/null
| 
| 
| BUT:
| 
| from the HISTORY file:
| 
| 1995/10/29: v3.11pre4
|             Changes to procmail:
|                - varname ?? < nnn conditions didn't have the expected effect
| 
| So that might not work if you have an older version.

This will work with some older versions (if they are stil new enough to have
the variable ?? syntax at all):

  :0
  * ^Cc:\/.*
  { 
    PERMITTED_LENGTH=some_limit_you_set

    :0
    * 1^1 MATCH ?? .
    * $ -$PERMITTED_LENGTH^0
    /dev/null
  }

Personally I would do it not by the number of characters but by the number of
addresses in the Cc: header:

  :0
  * ^Cc:\/.*
  { 
    PERMITTED_COUNT=some_limit_you_set

    :0 # note the comma instead of a period
    * 1^1 MATCH ?? ,
    * $ -$PERMITTED_COUNT^0
    /dev/null
  }

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