procmail
[Top] [All Lists]

Re: Detecting multiple To: headers?

1999-06-04 11:31:07
* "Philip" == Philip Guenther <guenther(_at_)gac(_dot_)edu> writes:

Philip> Tony Lam <Tony(_dot_)Lam+procmail(_at_)eng(_dot_)sun(_dot_)com> writes:

A little more accurate way is to use either your recipe or
Philip/David's recipe to count comma separated items in "To", "Cc",
"Resent-To" separately and sum them up as total number of
recipients. Still it doesn't handle well messages with multiple "To"
or "Cc" lines.

Philip> David and my method of the recursive INCLUDERC does handle
Philip> multiple To: and/or Cc: header.  Each occurance of a header
Philip> that matches the header selection regexp that's passed to the
Philip> INCLUDERC results in another invocation of the INCLUDERC.  The
Philip> embedded comma problem is it's only major failing.

Hm.. It seems to me the initial run only grabs the first "Cc" line,
e.g. initial HEADERLINES gets "Person11 <person9(_at_)some(_dot_)com>, "Person12
LastName" <person10(_at_)some(_dot_)edu>" in the example below:


    REGEXP = "^Cc:"

    # Put the string to match against into $HEADERLINES
    :0 # H is implicit
    * $ ()\/$REGEXP(.*)$
    {
      # Set up the initial run.
      HEADERLINES = $MATCH
    
      # What's the maximum number of items allowed?  This passes, one more
      # get's torched.
      EXCESS = -19
    
      # Let it rip.
      INCLUDERC = count_comma_sep.rc
    
     :0 # count was predefined and prejudiced at -19 
     * $ $EXCESS^0
     { EXITCODE=77 HOST }
    }


    To: Person1  <person1(_at_)some(_dot_)com>, "Person2 LastName" 
<person2(_at_)some(_dot_)edu>
    cc: Person11  <person9(_at_)some(_dot_)com>, "Person12 LastName" 
<person10(_at_)some(_dot_)edu>
    cc: Person3 <person3(_at_)some(_dot_)com>, Person6 
<person4(_at_)some(_dot_)com>, Person4 <person4(_at_)some(_dot_)com>, Person7 
<person4(_at_)some(_dot_)com>, Person5 <person5(_at_)some(_dot_)com>, Person8 
<person4(_at_)some(_dot_)com>
    cc: Person9  <person9(_at_)some(_dot_)com>, "Person10 LastName" 
<person10(_at_)some(_dot_)edu>


What am I missing?


Tony