procmail
[Top] [All Lists]

Re: spam filtering for dummies

2000-02-05 15:43:13
At 03:32 AM 2/5/00 -0600, Janelle H wrote:

[snip]

What I currently have in my .procmailrc file is a whole bunch of recipes
that look pretty much like this:

:0
* ^From:(_dot_)*(_at_)mailexcite(_dot_)com
$HOME/mail/filtered

Obviously, though, this recipe only looks at the "From" line.  What I
would like to do is have a recipe that searches the entire header for the
given search string.

Let's reword what you said slightly:  that recipe does look at all the
header lines, but the condition you have set for a match will match
only those lines starting with "From:".

With that in mind, to match any header, just delete the part that
matches the "From:":

:0:
* @mailexcite\.com
$HOME/mail/filtered

Note that the period matches any character (including a period) but to limit
it to exactly a period, escape it with a backslash as I did there.  Also
I deleted the ^.* that would have remained, because that would do nothing.

Finally, I added a ":" after your ":0" because you will want a lockfile
since you're delivering to a disk file.

Someone else posted a way to look in specific headers; note that
the one I gave above will match even the Subject: header.  It is possible
to bypass just that one if you think it might be worth the trouble
if, say, someone wrote you with:
    Subject: is xxxyyyzzz(_at_)mailexcite(_dot_)com a spammer?

:0:
* ^([^S]|S[^u])(_dot_)*(_at_)mailexcite\(_dot_)com
$HOME/mail/filtered

will look in all headers that don't start with "Su" for example,
which probably will do in "real life."

The usual disclaimer: these are untested for typos :-)

Hope that helps,
Stan

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