User Tools

Site Tools


how_to:write_your_own_spam_filter_rules

How to write your own spam filter rules

VPOP3's spam filter uses a basic scripting language designed for filtering email messages, so a full description of writing your own rules would be very long and complex, as it is really something that only a programmer should do.

For a technical reference, see our Spam Filter Rules documentation.

A basic thing that people might want to do is to filter on a phrase, you could do this simply by editing the 'spamrules_userchecks.txt' file in the VPOP3 directory, use something like:

BulkScan Score [MyTests]
Subject "subject words" 100
Body "this is a message body phrase to check for" 100
AnyText "this is something to check for in the subject OR body" 100
EndBulkScan

If you just have the text to search for, then VPOP3 will do a simple substring match. For more flexibility you can use regular expressions, and surround the regex pattern in '/' characters. VPOP3 uses PCRE regexes. If the search text or regular expression contains spaces, then you need to surround the search expression with “ quotes.

eg

BulkScan Score [MyTests]
Subject /subject\s+words/i 100
Body /this\s+is\s+a\s+message\s+body\s+(phrase|sentence)\s+to\s+(check|test)\s+for/i 100
AnyText /this\s+is\s+something\s+to\s+check\s+for\s+in\s+the\s+subject\s+(?i:OR)\s+body/ 100
Body "/this is a regular[- ]expression with spaces in/i" 100
EndBulkScan
how_to/write_your_own_spam_filter_rules.txt · Last modified: 2018/11/14 10:45 (external edit)