[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: filtering spam with procmail



Richard Klinda <ignotus@freemail.hu> writes:
> Hoi Noah!
> 
>   Noah> Hey all.  Over the past couple weeks or so the volume of
>   spam to my inbox has grown by a disturbing amount (I should
>   have been more careful...).
> 
>   Noah> I'm not sure what to use for such a procmail rule, though.
>   Does anybody here do anything similar to this?  If so,
>   what's the best way?
> 
> Take a look at junkfilter, it does exactly what you want (and much
> more).

It's not that bad to do in procmail, especially if you're already
using procmail to sort for things like mailing lists and don't want
the hassle of learning an entirely new tool like junkfilter. What I do
is have a set of rules at the top of my ~/.procmailrc that picks out
all the mail to mailing lists to which I subscribe. They look like:

:0:
* ^X-Mailing-List:.*debian-user|^TOdebian-user
Mailing.Lists.spool

Then at the bottom of my ~/.procmailrc I have some general rules that
apply to valid email addresses for me and anything that doesn't match
these goes to the spam box. As an example:

:0:
* !^TO.*sandia.gov
* !^TO.*glhenni
* !^TO.*[hH]ennigan
* !^TO.*[Gg]ary
Spam.spool

The rule above says that any email coming in that doesn't match any of
the specified patterns in a "TO" header ("TO" is an alias used by
procmail to specify several actual "to-like" headers) should go the
file Spam.spool. If you've noticed, most Spam doesn't actually go to
your email address. They use some alias like "To: friend@public.com"
or similiar.

I've been using this for about a year now and I'd say it eliminates
about 95% of the spam I get and I can recall only one occasion that it
trapped a valid email in my spam box, and I modified the rules so that
it wouldn't happen again. I check my spam box about once a week and
generally do a:

echo -n "" > Spam.spool

to clean it out.

Gary



Reply to: