euglug.org

[Eug-lug] More advanced procmail voodoo

작성자

카테고리:



Patrick R. WadeSat Dec 10 18:25:27 PST 2005

Rob Hudson wrote:
> I think I have a similar question for procmail while we're at it...  I'm 
> using dspam for spam filtering.  It gives headers of the form:
> 
>     X-DSPAM-Result: Spam
>     X-DSPAM-Confidence: 0.5065
>     X-DSPAM-Probability: 1.0000
>     X-DSPAM-Signature: some kind of hash
> 
> I'd like to filter those with result=Spam and with a confidence above a 
> certain threshold to /dev/null since I'm pretty comfortable I never want 
> to see those.  The ones with lower confidence I may want to save in case 
>  of a false positive for spam.
> 
> I've filtered on a single header before but never two.  How do you do that?
> 

Procmail conditions are ANDed ;

:0
* ^X-DSPAM-Result: Spam
* ^X-DSPAM-Confidence: 0.5065
* ^X-DSPAM-Probability: 1.0000
* ^X-DSPAM-Signature: some kind of hash
/dev/null

will match exactly the message with the sample headers you showed. 
Matching
* ^X-DSPAM-Confidence: (some value greater than N)
Is a little more complicated, i'm not sure how to approach it except to 
say that the parts in condition lines are equivalent to egrep regular 
expressions.  If you're better at regex voodoo than i am, you can 
probably come up with it.



-- 
On two occasions I have been asked [by members of Parliament!], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able rightly to apprehend the kind of
confusion of ideas that could provoke such a question.
	-- Charles Babbage