procmail
[Top] [All Lists]

Re: Invalid message-ids

1997-08-11 11:08:00
At 11:02 AM 8/11/97 -0400, Stan Ryckman wrote:

Timothy J Luoma <luomat+procmail(_at_)luomat(_dot_)peak(_dot_)org> wrote:
:0:
* ! ^Message-ID:\ \<\>

! IF NOT MATCH
^ STARTING AT BEGINNING OF LINE
"Message-ID:"
"\ " - one space        (Normal regexp for this is "\s", but egrep doesn't
recognize it -- "\ " IS valid though, as would be a non-escaped space.
[:space:] should work too.)
"\<" - Match the empty string BEFORE a word (see man procmailrc)
"\>" - Match the empty string AFTER a word (see man procmailrc)

(that is \< and \> are metas similar to ^ and $)

This would act basically as Era said,

To match "Message-ID: <>" at the BEGINNING of a line (allowing for variable
spacing before the brackets, and possibly space inside as well), you could
use:

* ^Message-ID:\ +<\ *>

Which works for me - someone asked what I was using, and there were other
posts, so I didn't bother responding on that at the time.  This is what I
use.  I haven't had problems with it.

Should anyone wonder if a ruleset would work, don't forget that you can put
the ruleset into a standalone recipe file, and redirect a message into it:

procmail bogusid.rc < sometestmessage

where, in this case, bogusid.rc is the following recipe.  Note that I've
added the second ruleset, which should catch messages which do not even
have a message-id (not just an EMPTY identifier).  I suspect this is how
the ! crept into the recipe being bounced around here.


:0:
* ^Message-ID:\ +<\ *>
Test_SPAM

:0:
* ! ^Message-ID:
Test_SPAM

:0:
Test_NotSPAM


You can then modify the test message with different variations.  In this
particular case, since it matches from the beginning of the line, you can
have several variations of the Message-ID, extracted from multiple messages
you've recieved - I just prefix the ones I'm not testing for with "X", and
run the test.

I haven't done it, but I presume you could use formail to extract a couple
of your mailboxes to redirect a bunch of standard mail into the test recipe
in this fashion, which would allow you to verify that none of your regular
mail (as defined by mail you've already recieved) would have been
misdirected by the recipe.  After extracting all your regular mail, you'd
simply verify that the Test_SPAM folder still doesn't exist - if it does,
check it - it may have caught spam which fell through your original
filtering, or perhaps you're dealing with some folk sending mail in a
non-compliant fashion...

Actually, I think the things \< and \> match just happen to include
< and >  , thus that would probably "work" except for the ! you noted.

Escaped characters mean more than just escaping them from the OS (and this
isn't a shell command, so it wouldn't be necessary to escape them).  In
this particular case, these escaped characters ARE special to Procmail.
Check the man pages.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

<Prev in Thread] Current Thread [Next in Thread>