After moving my mail server to Zimbra, my (very patient) wife complained that she was getting a lot more spam in her new inbox.

So today I spent a couple of hours figuring out why spamassassin was doing a bad job on some obvious spam email.

I took a look at the headers of some of her incoming undetected spam. Bayes training was not the problem: all of them had BAYES_99 set as almost certainly spam.

One solution would be to turn up the score on such a strong match, but that didn't seem right to me. Maybe activating more DNS Blacklists would take care of it, but the ones already in use seemed about right.

I compared the spamassassin configurations on my new and old mail servers, and realized that razor2 and pyzor were not enabled.

On my Ubuntu 10.04LTS server I installed the packages:
Code:
apt-get install razor
apt-get install pyzor
I worked through the tips from the Zimbra wiki on adding Razor2 and adding pyzor to Zimbra's spamassassin.

The document is a few years out of date, and I ran into a few glitches.

Once I found an executable spamassassin (in /opt/zimbra/zimbramon/bin/spamassassin) I could run it in debug mode, feeding a known spam into it as stdin.

Razor2 came up right away, finding its config directory and processing the spam. That already improved my results noticeably!

Pyzor had a two problems:

The first was a missing configuration line in /opt/zimbra/conf/spamassassin/local.cf:

Code:
pyzor_options --homedir /opt/zimbra/amavisd/.pyzor
The second was a failure to parse the output of pyzor because of a deprecation warning related to Python 2.6. The warning in the output confused spamassassin.

The solution to that is to make an edit to the pyzor executable, in /usr/bin/pyzor (for me). Change the hash-bang line as follows:

Code:
#!/usr/bin/python -Wignore::DeprecationWarning
Finally I added "ok_languages en" to my local.cf, only to have spamassassin ignore the line. The language processing is moved to a spamassassin add-in TextCat, which is fortunately already installed with Zimbra. It just needed to be enabled:

Code:
loadplugin Mail::SpamAssassin::Plugin::TextCat
With these changes, spamassassin is hitting Razor2 and Pyzor successfully and whacking at the spam.

Mojo