procmail
[Top] [All Lists]

Re: recipe to match multiple recipients (say > 4)

2002-04-12 09:03:42
On 12 Apr, Eric Smith wrote:
| How could I do that?  Recipints either in the To: or Cc:.
| 

This might get you there.  Others might have something simpler.

N.B. This counts "@" characters, so it will not correctly count local
and not fully qualified addresses (i.e. user name sans "@domain"), or
bang paths (which probably doesn't matter). If either of those
limitations is a problem. I suppose you could count commas instead.

LINEBUF=8192
:0
* ^To:\/.*
* 1^1 MATCH ?? @
{ xTOCOUNT = $= }
:0A
* $ $xTOCOUNT^0
*          -4^0
{
  # "To: $xTOCOUNT recipients"
  xCHKBOTH = -2147483647
  # do whatever you want here
}

:0
* ^Cc:\/.*
* 1^1 MATCH ?? @
{ xCCCOUNT = $= }
:0A
* $ $xCCCOUNT^0
*          -4^0
{
  # "Cc: $xCCCOUNT recipients"
  xCHKBOTH = -2147483647
  # do whatever you want here
}

:0
* $ ${xCHKBOTH:-0}^0
* $ ${xTOCOUNT:-0}^0
* $ ${xCCCOUNT:-0}^0
*               -4^0
{
  # "To: $xTOCOUNT + Cc: $xCCCOUNT = $= recipients"
  # do whatever you want here
}
xTOCOUNT   xCCCOUNT   xCHKBOTH


-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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