procmail
[Top] [All Lists]

Re: check filtered stream but deliver unfiltered

2001-12-06 08:44:54
On [2001-Dec-05]  PSE-L(_at_)mail(_dot_)professional(_dot_)org 
<PSE-L(_at_)mail(_dot_)professional(_dot_)org> wrote:
At 10:57 2001-12-05 -0800, Bart Schaefer wrote:
That'll send both the headers and the body of the message through
"yourscript", in addition to the problem of storing an entire copy of the
message in a variable.  Better:

Yo! Bart, pleaes read the original request - the requestor isn't asking to 
simply run a script and trigger on the return value of the result - he 
wants to _TRANSFORM_ the message (in the cited example, converting it from 
HTML to plaintext), then perform further operations/tests on the 
TRANSFORMED copy, but still eventially deliver the ORIGINAL, UNTRANSFORMED 
version.  A simple 'c' flag won't do what he wants, and your suggestion 
does _zilch_ for allowing him to process the transformed message using 
procmail.

I tried to implement various incantations of the suggestions but the tests 
didn't succeed in getting a match (the log showed the variable getting set to 
the non-html text but procmail didn't report success even though the match was 
found if I wasn't trying to use the vaiable's content on the condition line). 
In the interest of getting at least a functional starting point I punted and 
went for the external file approach and layered that onto Junkfilter (rather 
than my local test scripts):

# start the spam tests

#keep a copy of the message
:0c
/tmp/.

#make sure we remove the copy when we're done
HOLD=$LASTFOLDER
TRAP="/bin/rm -f $HOLD"


#check the message for spam triggers (if the body is in html it'll be converted
#to plaintext by w3m before testing)
INCLUDERC=$JFDIR/junkfilter


#if a spam trigger was found deliver the UNTRANSFORMED, i.e. still in HTML,
#version to the spamfile

:0 :
* $JFEXP ?? .
| formail -i "X-junkfilter: $JFVERSION" -i "X-Spammer: $JFEXP" <$HOLD >> 
$SPAMFILE

# if the above recipe didn't deliver then it wasn't seen to be spam so deliver
# the original (UNTRANSFORMED) message to my mailbox

:0E
| cat $HOLD >> $DEFAULT 

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