Bootstrap FreeKB - Postfix (Email) - Flag foreign language email using SpamAssassin
Postfix (Email) - Flag foreign language email using SpamAssassin

Updated:   |  Postfix (Email) articles

Let's say you want emails that contain a foreign language to be flagged as spam. In /etc/mail/spamassassin/local.cf you could add the following rules. In this example, emails that contain a language other than English will be flagged as spam.

ok_languages  en

 

You may also want to set a custom score for UNWANTED_LANGUAGE_BODY in /etc/mail/spamassassin/local.cf.

score    UNWANTED_LANGUAGE_BODY    5.0

 

Uncomment the following line in /etc/mail/spamassassin/v310.pre.

loadplugin Mail::SpamAssassin::Plugin::TextCat

 

Restart SpamAssassin and the SpamAssassin Milter for this change to take effect.

systemctl restart spamassassin
systemctl restart spamass-milter

 

Ensure the following command does not return any warnings or errors.

sudo spamassassin --lint

 

Send a test email with something a foreign language in the body and ensure /var/log/maillog identifies the email as spam.

Mar  3 22:46:14 ip-172-31-19-227 spamd[987]: spamd: identified spam (5.0/5.0) for sa-milt:992 in 0.4 seconds, 2104 bytes.
Mar  3 22:46:14 ip-172-31-19-227 spamd[987]: spamd: result: Y 5 - MY_RULE scantime=0.4,size=2104,user=sa-milt,uid=992,required_score=5.0,rhost=::1,raddr=::1,rport=37236,mid=<c4a892c4bde2be502e1f326b1df338767e482390@webmail>,autolearn=no autolearn_force=no



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 89435d in the box below so that we can be sure you are a human.