Block Spam with russian encoding using spamassassin

Lately the amount of spam with russian encoding/charset that I was getting had increased significantly. Spamassassin’s configuration options “ok_locales” and “ok_languages” were not enough because I didn’t want to whitelist some language, but I just wanted to blacklist some.

So the solution for my problems was the addition of the following lines in the configuration of spamassassin:

header LOCAL_CHARSET_RUSSIAN Subject:raw =~/\=\?koi8-r\?/i
describe LOCAL_CHARSET_RUSSIAN Contains russian charset that is not acceptable

If you want to add even more charsets:

header LOCAL_CHARSET_BLOCKED Subject:raw =~/\=\?(koi8-r|windows-1251)\?/i
describe LOCAL_CHARSET_BLOCKED Contains charsets that are not acceptable

Be VERY careful with these rules if you place them in the global config (/etc/spamassassin/ because if any of your users are getting emails in russian those emails will be probably marked as spam!!

2 Responses to “Block Spam with russian encoding using spamassassin”

  1. May 1st, 2011 | 15:19
    Using Google Chrome Google Chrome 10.0.648.205 on Linux Linux

    Just from seeing the rules I believe there should be found a cleanest solution.

  2. Jamen
    March 26th, 2013 | 18:08
    Using Mozilla Firefox Mozilla Firefox 19.0 on Windows Windows 7

    I added this code to our, restarted Spamassassin, but about 20 minutes later, we got another Russian email. The Subject line has this:

    Subject: =?koi8-r?B?7NXe28nKINvLwcYg2sEg0M/Mw8XO2Swg08vJxMvJIDYwJQ==?=

    So theoretically, the test should have caught it, right? I’m not sure why it didn’t. If you have any suggestions, I’m all ears. Thanks!

Leave a reply