procmail
[Top] [All Lists]

Re: Use scoring to determine header format?

2004-05-17 20:45:24
On Mon, May 17, 2004 at 10:31:58PM -0400, fleet(_at_)teachout(_dot_)org wrote:
The following seems to work except for one problem:

:0
* -4^0
* 1^0 ^Received:(.*$)+Received:
* 1^0 ^Received:(.*$)+Received:
* 1^0 ^Received:(.*$)+Message-Id:
* 1^0 ^Message-Id:(.*$)+Received:
* 1^0 ^Received:
spamtest/gotcha

The problem is - How do I say in the last condition "Received: followed by
NOT Received.  I tried * 1^0 ^Received:(.*$)+[^Received:], which didn't
work.  (I didn't think it would, but it was worth a try.) I'd like to get
this to work even if the recipe turns out to be useless.  I'll have
learned a bunch.

The above doesn't work like you think; the ordering is arbitrary
except for your:

* 1^0 ^Received:(.*$)+Message-Id:
* 1^0 ^Message-Id:(.*$)+Received:

but there's no guarantee Message-Id will hit. If you had more than 5
Received headers, I think your recipe would trigger anyway (didn't
test that).

If you want to count a specific number of Received headers, followed
by a Message-Id heder, followed by another Received header, you'll
have to do something like Sean suggested, though maybe a tighter regex
for you:

:0
* ^Received:.*^Received:.*^Received:.*^Message-Id:.*Received:
spamtest/gotcha

Something like that, anyway.

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