SpamAssassin on Debian Linux in less than a minute

There are various ways of using Spamassassin  (SA) to filter and tag emails. A basic and generic one is shown here, this will

  • determine the likelyhood of an email being spam using SA and
  • deliver emails into different user mail folders based on the SA spam score.
  • No risk: No email or sender will be blocked, rejected or deleted.

While this approach is independent of the mail tranport agent (MTA) used (e.g. Postfix , Exim , etc.), is uses procmail  to deliver emails into different folders using Maildir-style user mailboxes (rather than mbox).


  • Get spamassassin via aptitude
  • Optional: Install the tools suggested by the spamassassin package: razor , dcc -client and pyzor  that access spam databases on the internet to help calculating the spam score of an email.


In user's home directory

mkdir .spamassassin
  • Create a file .procmailrc in the user's home directory

# check mail smaller than 250KB with spamassassin
* < 256000
| /usr/bin/spamassassin

# Catch SPAM and deliver suspected spam to Spam folder,
# while moving emails with scores above six to Spam/Plus 
* ^X-Spam-Level: \*\*\*\*\*\*

* ^X-Spam-Flag: YES


Send yourself some test mails. You should see tags added by SpamAssassin in the mails header, e.g

X-Spam-Level: ******
X-Spam-Flag: YES
X-Spam-Status: ....(some text)...

and procmail should have delivered emails depending on their spam score to either your Inbox, your Spam or your Spam/Plus folder.


With a few simple steps you now have a spam filter on your machine that reduces the amount you spam in your inbox daramtically. You may occasionally want to check the Spam folder so that you do not miss any emails that have been regarded as spam by mistake (aka False Positives, FP). What gets delivered into the Spam/Plus folder should most certianly be spam which you will not want to look at.

Read on if you want to know more about SpamAssassin's features.

Comments (1)