Filtering Spam with qmail and SpamAssassin on Red Hat Fedora 2

I have a customer with several web sites hosted on a dedicated server.

The server uses qmail as MTA and I wanted to install SpamAssassin to filter out spam.




Aftert a little search, I didn't find a clear documentation of how to connect SpamAssassin with qmail. Two useful pages I found were:
How to use Spamassassin together with Qmail and SpamAssassin with qmail / Vpopmail



I wanted to filter on a per-account basis and I was having some problem with the recipe from the 1st page. So basically I adapted the information and here's what it worked for me:




  1. I installed SpamAssassin, more or less like explained in the 2nd page

  2. I edited the file /etc/mail/spamassassin/local.cf

  3. I checked with a spam example (save a spam email with full headers) that it works from the command line: spamc < spam.txt
  4. I downloaded and installed safecat (contains the maildir tool)
    by the way, it gives an error warning when maildir is executed but it works.

  5. As mail user ("popuser") I edited the .qmail file of the account ("webmaster") located at /var/qmail/mailnames/domainhere.com/webmaster/.qmail with the following:

    | spamc |maildir ./Maildir/

  6. I checked that it was working: cat spam.txt | spamc |maildir ./Maildir/

  7. I (re)started SpamAssassin: /etc/init.d/spamassassin restart