procmail
[Top] [All Lists]

Re: Scoring for a header

2004-04-28 13:39:42
On Wed, Apr 28, 2004 at 01:54:31PM -0600, LuKreme wrote:
On 28 Apr 2004, at 28d, 11:50, Scott Wiersdorf wrote:
In this case, then, you'll get the To: field, even though your
original trigger (^Cc:) led into this recipe. You may have to attack
this from a different angle to make sure the inner recipe is looking
at the same thing you matched:

I want ALL of ^TO_ not To: or Cc: but all the emails in the ^TO_ match

Ah, you'll probably have to break up the ^TO_ macro into its parts to
get them all. Procmail does the shortest and earliest match it can, so
any attempt to "grab it all" with a single regex isn't going to do it
(at least, I can't think of a good way to do it). You might try an
expansion of ^TO_:

  :0c
  * ^To:(.*[^-a-zA-Z0-9_.])?\/.*
  { TO = $MATCH }

  :0c
  * ^Cc:(.*[^-a-zA-Z0-9_.])?\/.*
  { CC = $MATCH }

  :0c
  * ^Bcc:(.*[^-a-zA-Z0-9_.])?\/.*
  { BCC = $MATCH }

  :0c
  * ^Original-To:(.*[^-a-zA-Z0-9_.])?\/.*
  { OTO = $MATCH }

  :0c
  * ^Original-Cc:(.*[^-a-zA-Z0-9_.])?\/.*
  { OCC = $MATCH }

  :0c
  * ^Original-Bcc:(.*[^-a-zA-Z0-9_.])?\/.*
  { OBCC = $MATCH }

  :0c
  * ^Resent-To:(.*[^-a-zA-Z0-9_.])?\/.*
  { RTO = $MATCH }

  :0c
  * ^Resent-Cc:(.*[^-a-zA-Z0-9_.])?\/.*
  { RCC = $MATCH }

  :0c
  * ^Resent-Bcc:(.*[^-a-zA-Z0-9_.])?\/.*
  { RBCC = $MATCH }

  :0c
  * ^Original-Resent-To:(.*[^-a-zA-Z0-9_.])?\/.*
  { ORTO = $MATCH }

  :0c
  * ^Original-Resent-Cc:(.*[^-a-zA-Z0-9_.])?\/.*
  { ORCC = $MATCH }

  :0c
  * ^Original-Resent-Bcc:(.*[^-a-zA-Z0-9_.])?\/.*
  { ORBCC = $MATCH }

  :0c
  * ^X-Envelope-To:(.*[^-a-zA-Z0-9_.])?\/.*
  { XETO = $MATCH }

  :0c
  * ^Apparently-To:(.*[^-a-zA-Z0-9_.])?\/.*
  { ATO = $MATCH }

  :0c
  * ^Apparently-Resent-To:(.*[^-a-zA-Z0-9_.])?\/.*
  { ARTO = $MATCH }

  :0
  { ETO = `echo "$TO, $CC, $BCC, $OTO, $OCC, $OBCC, $RTO, $RCC, $RBCC, \
                 $ORTO, $ORCC, $ORBCC, $XETO, $ATO, $ARTO" | sed 's/[, ] 
\{1,\}/|/g'` }

Someone else might figure out a clever way to match and delete in a
loop using ^TO_ only, which would be a cool thing.

Scott
-- 
Scott Wiersdorf
scott(_at_)perlcode(_dot_)org

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