How to Filter Foreign Language Spam with SpamAssassin

Using an Email Filter

SpamAssassin for email spam filtering uses a variety of techniques to detect spam including DNS-based methods, Bayesian filtering, blacklist, external programs and online databases. It applies a large set of rules which are matched against the body or header of a message, to assess whether an email is spam. Each test results in an assigned score if it matches the criteria of the test.

SpamAssassin treats all languages equally; however, you can configure it to parse each message and determine the language used.

If it is not one of the "allowed" languages, SpamAssassin automatically adds a few points the message's spam score. If SpamAssassin is not sure about the language used, no points are assigned.

Filter Foreign Language Spam with SpamAssassin

To have SpamAssassin filter out mail in foreign tongues:

  • Open /etc/mail/spamassassin/local.cf in your favorite editor.
  • If not present, add "ok_languages " on a line of itself.
  • List the languages (from the list below) you want to accept, separated by spaces:
    • af - Afrikaans
    • sq - Albanian
    • am - Amharic
    • ar - Arabic
    • hy - Armenian
    • eu - Basque
    • bs - Bosnian
    • bg - Bulgarian
    • be - Belorussian
    • ca - Catalan
    • zh - Chinese
    • hr - Croatian
    • cs - Czech
    • da - Danish
    • nl - Dutch
    • en - English
    • eo - Esperanto
    • et - Estonian
    • fi - Finnish
    • fr - French
    • fy - Frisian
    • ka - Georgian
    • de - German
    • el - Greek
    • he - Hebrew
    • hu - Hungarian
    • hi - Hindi
    • is - Icelandic
    • id - Indonesian
    • ga - Irish Gaelic
    • it - Italian
    • ja - Japanese
    • ko - Korean
    • la - Latin
    • lv - Latvian
    • lt - Lithuanian
    • ms - Malay
    • mr - Marathi
    • ne - Nepali
    • no - Norwegian
    • fa - Persian
    • pl - Polish
    • pt - Portuguese
    • qu - Quechua
    • rm - Rhaeto-Romance
    • ro - Romanian
    • ru - Russian
    • sa - Sanskrit
    • sco - Scots
    • gd - Scottish Gaelic
    • sr - Serbian
    • sk - Slovak
    • sl - Slovenian
    • es - Spanish
    • sw - Swahili
    • sv - Swedish
    • tl - Tagalog
    • ta - Tamil
    • th - Thai
    • tr - Turkish
    • uk - Ukrainian
    • vi - Vietnamese
    • cy - Welsh
    • yi - Yiddish

    To accept mail in English, German, Latin, Thai and Swedish, for example, use "ok_languages en de la th sv".