[Rspamd-Users] Block emails with Chinese and Cyrillic characters in the subject

Andreas rspamd at linuxmaker.com
Wed Aug 6 09:27:43 UTC 2025


Hello everyone,

I want to use Rspamd to block emails whose subject line contains Chinese or 
Cyrillic characters. The reason is that such emails are unreadable in our 
environment and usually contain unwanted content.

I have defined the following rules for this:

BANNED_CYRILLIC { 
        type = "header";  
        header = "Subject";  
        filter = "regexp";  
        map = "${LOCAL_CONFDIR}/local.d/maps.d/banned_cyrillic.map";  
       symbol = "BANNED_CYRILLIC";  
        description = "Subject contains Cyrillic characters";  
        action = "reject";  
}  
 
BANNED_CHINESE {  
        type = "header";  
        header = "Subject";  
        filter = "regexp";  
        map = "${LOCAL_CONFDIR}/local.d/maps.d/banned_chinese.map";  
       symbol = "BANNED_CHINESE";  
        description = "Subject contains Chinese characters";  
        action = "reject";  
} 

The associated maps show:

banned_chinese.map:
/[\u4E00-\u9FFF]/u

banned_cyrillic.map:
/[\u0400-\u04FF]/u

Unfortunately, this doesn't work as expected. Emails containing these 
characters aren't reliably blocked.

Does anyone have a tip on how to reliably implement this with Rspamd? Perhaps 
I'm doing something wrong with the regular expressions or the map 
configuration.

Thanks in advance!

Andreas




More information about the Users mailing list