Using procmail to filter out Russian emails

Lots of the spam I get uses the Cyrillic alphabet. I believe it’s Russian. I don’t correspond with anyone using the Cyrillic alphabet, so I’ve come up with a procmail recipe to filter this email out. But first some background.

It seems that the subject lines of many (all?) Cyrillic emails look something like this:

Subject: =?koi8-r?B?7e/06ffh4+nxIPTy9eTh?=

Which appears like this in your email reader:


The “KOI8-R” you see in the above Subject line refers to a popular Cyrillic encoding and indicates to the mail client that the rest of the text is thusly encoded. For more info, Wikipedia has a nice article on KOI8-R. There is another encoding, called windows-1251 that is also used to encode Cyrillic, albeit less commonly than KOI8-R.

To filter out these messages, I added two super simple procmail recipes to my .procmailrc file:

* Subject:.*koi8-r

* Subject:.*windows-1251

Keep in mind that for these recipes to work, the Cyrillic stuff has to appear in the email subject, which most of my spam seems to do. I haven’t done extensive testing, but will let this run for the coming weeks and report how it worked.

Write a Reply or Comment

Your email address will not be published.