I've got my spam filtering set up in a fairly standard way, using procmail and spamassassin to filter, and mutt to read what's left.
The filtering method I describe here assumes that you want to filter email on a mail server. A mail server running Unix (or something Unix-like, such as Linux, FreeBSD, and the rest), to be exact.
I'm also assuming you're the administrator of said mail server, or at least are in a position to ask the administrator really really nicely to please help you make this all work.
As an aside... If this isn't the case, you'll be better off with a spam filter built into your mail program. Mozilla's mail program does really good mail filtering. So does Mozilla Thunderbird. Apple's Mail program also does a very good job. On Windows, Outlook does really shitty filtering, but there's an add-on program (I forget the name, sorry) that does some much better filtering based on community feedback.
If you run your own mail server, and want to filter your mail before it gets to your mail reader, you've come to the right place. Read on.
To understand mail filtering, you've got to know a little bit about
mail delivery. Actually, you've got to know very little about
delivery. All you really need to know is that it's controlled by your
~/.forward file. Instead of dropping mail in your
mailbox, you have to redirect the mail delivery to the procmail
program. To do that, put the following entry (modified for your own
username and local setup, of course) in ~/.forward,
including the quotation marks:
"|IFS=' ' && exec /usr/bin/procmail || exit 75 #alex"
When mail comes in, it gets caught first by procmail, which decides
what to do with each message based on the rules in its config file,
~/.procmailrc.
In my configuration file, the default action is to pass the message
to spamassassin's spamc program for processing according
to its config file,
~/.spamassassin/user_prefs, as well as the
system-wide config files in the
/usr/local/share/spamassassin/ directory.
Spamassassin tags suspected spam messages so I can filter them out
with some other tool. In my case, I take advantage of the fact that a
message gets processed by each procmail rule in succession. Thus, the
next rule in the procmail configuration sticks all tagged spam into my
spam mailbox.
Astute readers will notice that there's another spam rule in my
~/.procmailrc
file. That rule checks the message against the entries in ~/.mutt/spammers
and, if there's a match, tosses the message straight in the bit
bucket, never to be seen again.
After the mail is processed by procmail, it's time to read my mail.
The .muttrc
configuration file I use is available for your perusal, as well as
all the supplementary configuration files that I use for various
options. I'm not going to explain them for you, but they are here for your reference if you'd
like.
Last updated Tuesday, 02-Sep-2008 21:28:57 PDT