procmail
[Top] [All Lists]

Re: Looping problem

2002-06-07 13:03:39
Thank you the solution works great.

Steve.

You're right. It is a loop. The condition that causes a match in the
outer block, is unchanged (i.e. still matches) when you forward the
mail after munging the Subject: header. Try something like:

:0
* ! ^TO_steve(_at_)DFAS(_dot_)com
* ! ^X-Loop: steve(_at_)DFAS(_dot_)com
* ^Subject:[   ]*\/[^  ].*
* MATCH ?? ^^\/.*[^    ]
{
 :0 fhw
 |formail -I"Subject: NOT 2 STEVE-> $MATCH" -A"X-Loop: 
steve(_at_)DFAS(_dot_)com"
 :0
 ! steve(_at_)DFAS(_dot_)com
}

Note there is no lock (:) on the forwarding recipe. That should be a
little more efficient "cleaning up" the Subject:, and prevent the loop.
It is a <space> and <tab> inside the 3 character classes.  Assuming
this this is all on the same machine (i.e. forwarding to 
steve(_at_)DFAS(_dot_)com
sends it right back to the same place), which seems likely because of
the loop, you can "simplify" that to:

:0 fhw
* ! ^TO_steve(_at_)DFAS(_dot_)com
* 1^0
* 1^0 ^Subject:[       ]*\/[^  ].*
* 1^0 MATCH ?? ^^\/.*[^        ]
|formail -I"Subject: NOT 2 STEVE-> ${MATCH:-no Subject}"

:0A:
$DEFAULT

The 3 scored conditions (beginning with 1^0) make sure the filter is
still run if there is no Subject: header.  You could also add a
lockfile to the first recipe, redirect the formail output to $DEFAULT,
and skip the last recipe.  I'm not personally fond of that construct
for some inexplicable reason.

Lastly, I don't use ^TO and ^TO_ myself, but that looks like correct
usage.



_______________________________________________________
WIN a first class trip to Hawaii.  Live like the King of Rock and Roll
on the big Island. Enter Now!
http://r.lycos.com/r/sagel_mail/http://www.elvis.lycos.com/sweepstakes
_______________________________________________
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>