2

Is it possible to give a score to e-mails written in a specific language?

Background info: In specific cases I use score rules in the .spamassasin/user_prefs file. Some of our e-mail accounts receive extraordinary many spam messages in the Chinese language; other accounts in the Russian language. I'd like to make the score for these languages a little bit higher, on user account level, so using the user_prefs file in only certain mail accounts.

I know about the method using ok_languages (in local.rc) in combintation with UNWANTED_LANGUAGE_BODY in user_prefs. However this blocks (or scores) ALL languages not mentionned in ok_languages. That's the reverse of what I want to acheive: I want to give a little bit higher score to messages from a single language, not all languages not mentionned in ok_languages. We receive mail from all over the world so that's why I don't want to block all the messages written in a certain language, I only want to make the score a little bit higher for messages written in a certain language, still accepting mail from all other languages. How can I do this in Spamassasin?

terano
  • 29
  • 5

1 Answers1

0

See https://metacpan.org/pod/Mail::SpamAssassin::Plugin::TextCat

You can use a regex to score specific languages, like so

header BAD_LANGS X-Languages =~ /\b(?:ja|zh)\b/
score BAD_LANGS 1

Here, any languages matching ja for Japanese or zh for Chinese add a point to the SA score. Add additional two-letter codes for each language to the regex like so with the pipe character between them:

header BAD_LANGS X-Languages =~ /\b(?:ja|zh|en|it|es)\b/

StevieD
  • 2,329
  • 13
  • 30