On Tue, Feb 25, 2003 at 11:30:33AM +1300, Hamish McBrearty wrote:
> OK, I asked this one on www.justlinux.com but didn't get any takers. I'm
> trying to get my many email addresses organised. I've setup Gotmail to
> forward all my mail to a pop account, which Fetchmail downloads, as well
> as some other pop accounts. Postfix picks them up from there and I check
> them using Evolution. Sounds simple enough really.
>
> How do I add Spamassassin to the mix to help filter out the crap I get?
> I've searched on this and can't seem to find anything simple, or anything
> that doesn't involve Sendmail.
Easy method number one - add a call to SpamAssassin in your procmail
recipie, and then have procmail do something depending on the output.
Here's my (edited) procmailrc that uses SpamAssassin :-
(BTW, use VERBOSE=yes and provide a logfile, so you can debug the rules
as they get used ... take them out later on once you're happy)
Basically, with :0fw, all incoming email is piped to spamassassin. This
will add a header to the message, X-Spam-Flag; YES, which I detect later
on - anything that is spam gets /dev/null'd. I used to put it all in a
mailbox and delete it manually later, but it works for me.
LOGFILE=$HOME/.procmail.log
VERBOSE=yes
SA=/usr/local/bin/spamassassin
# General process :-
## Add headers indicating spamassassin results
## Refile all spam to a bin
## Refile everything else to INBOX
## Add headers indicating spamassassin results
# Pipe all messages (except those already checked) into $SA,
# but beware of exit failures
:0fw
| $SA
:0e
{ EXITCODE=$? }
## Delete all spam
:0
* ^X-Spam-Status: Yes
/dev/null
## ## Refile all spam to a bin
## :0
## * ^X-Spam-Flag: YES
## spambin
## Refile everything else to INBOX by dfault
I also refile mailing-list traffic into separate mailboxes (not in thie
example). I run spamassassin first, but kill spam last - so spam on
mailing lists gets through. My most common false-positive spam is
mailing list traffic :-) so this means I don't delete the messages
automatically.
-jim