======Spam Filter Rules====== VPOP3 Versions 2.1.7 and later have a built-in spam filter system which supports a simple script language optimised for content- and spam-filtering of email messages. This reference contains a definition of the spam filtering script language supported by VPOP3. Note that as later versions of VPOP3 are released, more language features may be added, so this reference indicates in which version of VPOP3 a particular feature was added. =====Language Introduction===== The VPOP3 Spam Filter scripting language is a very basic language designed to make it easy to implement message content filtering tasks. The language supports basic variables, conditional statements, simple loops, jumps, tests on message content, and simple actions to perform on the messages. The language is intended to be used by advanced users with some programming experience. VPOP3 comes with a pre-configured spam filter script, and it is recommended that you use that, and modify the configuration of that script using the Settings -> Spam Filter (Utilities -> SpamFilter in version 2) settings pages unless you are willing and able to modify and create a program using the filtering language. If you do need to create custom spam filter scripts and want us to do it for you, that is possible, but it is not covered by our standard support services. If you [[support@pscs.co.uk|contact us]] with details of what you want to do, we can tell you how much it will cost for us to do it. =====Spam Filter Rules Files===== VPOP3 reads the spam filter rules from the spamrules.txt file in the VPOP3 folder on the VPOP3 server's hard disk. This file can include other files by using the [[spamrules_statement_include|include]] statement. For instance, the default spamrules.txt file contains the statements include spamrules_initialise.txt include spamrules_userlocal.txt include spamrules_localmail.txt include spamrules_userchecks.txt include spamrules_checks.txt include spamrules_userprocess.txt include spamrules_processresults.txt include spamrules_userfinal.txt This means that VPOP3 reads the spamrules_initialise.txt, spamrules_userlocal.txt, spamrules_localmail.txt, spamrules_userchecks.txt, spamrules_checks.txt etc files in the specified order. The standard spam filter rules files that are distributed with VPOP3 are: * **spamrules.txt** - this is the main file, which, by default, includes the other files * **spamrules_initialise.txt** - this contains the initialisation of some variables which must come first in the script * **spamrules_localmail.txt** - this contains some standard rules to process messages sent by local users, for instance to add recipients of locally sent mail to the whitelist, process messages to 'notspam@' and 'spam@' etc * **spamrules_checks.txt** - this contains all the spam tests * **spamrules_processresults.txt** - this contains the standard behaviour to perform depending on the calculated spam 'score' These above files may be overwritten by future installations of VPOP3 and by the update procedure of the Spam Filter subscription. The **spamrules_user*.txt** files are for adding your own customised script entries, without them being overwritten by future installations of VPOP3. =====Language reference===== * [[spamrules_comments|Comments]] * [[spamrules_variables|Variables]] * [[spamrules_assignments|Assignments]] * [[spamrules_rule_names_and_weights|Rule names and weights]] =====Statements===== * [[spamrules_statement_star_ifsupport|*IFSUPPORT]] * [[spamrules_statement_star_stop|*STOP]] * [[spamrules_statement_addbag|AddBag]] * [[spamrules_statement_addbayesham|AddBayesHam]] * [[spamrules_statement_addbayesspam|AddBayesSpam]] * [[spamrules_statement_addblacklist|AddBlackList]] * [[spamrules_statement_addheader|AddHeader]] * [[spamrules_statement_addnulladdress|AddNullAddress]] * [[spamrules_statement_addwhitelist|AddWhiteList]] * [[spamrules_statement_bagsize|BagSize]] * [[spamrules_statement_break|Break]] * [[spamrules_statement_bulkscan|BulkScan]] * [[spamrules_statement_clearbag|ClearBag]] * [[spamrules_statement_convert|Convert]] * [[spamrules_statement_copy|Copy]] * [[spamrules_statement_copybag|CopyBag]] * [[spamrules_statement_countmatches|CountMatches]] * [[spamrules_statement_dbinsert|DBInsert]] * [[spamrules_statement_dbdeletekey|DBDeleteKey]] * [[spamrules_statement_dbdeletetime|DBDeleteTime]] * [[spamrules_statement_dbdeleteval|DBDeleteVal]] * [[spamrules_statement_dbupdate|DBUpdate]] * [[spamrules_statement_dbquery|DBQuery]] * [[spamrules_statement_dbqueryone|DBQueryOne]] * [[spamrules_statement_definerule|DefineRule]] * [[spamrules_statement_definesetting|DefineSetting]] * [[spamrules_statement_dns|DNS]] * [[spamrules_statement_dnsbl|DNSBL]] * [[spamrules_statement_escape|Escape]] * [[spamrules_statement_extralog|ExtraLog]] * [[spamrules_statement_FileBulkScan|FileBulkScan]] * [[spamrules_statement_foreach|ForEach]] * [[spamrules_statement_getaddresstype|GetAddressType]] * [[spamrules_statement_getdecodedsection|GetDecodedSection]] * [[spamrules_statement_getgeoip|GetGeoIP]] * [[spamrules_statement_getmd5|GetMD5]] * [[spamrules_statement_getrfc822date|GetRFC822Date]] * [[spamrules_statement_getsectionMD5|GetSectionMD5]] * [[spamrules_statement_getsectionencoding|GetSectionEncoding]] * [[spamrules_statement_getsha1|GetSHA1]] * [[spamrules_statement_getusergroup|GetUserGroup]] * [[spamrules_statement_globalmatch|GlobalMatch]] * [[spamrules_statement_goto|Goto]] * [[spamrules_statement_httpget|HTTPGet]] * [[spamrules_statement_httpgetmd5|HTTPGetMD5]] * [[spamrules_statement_httppost|HTTPPost]] * [[spamrules_statement_if|If]] * [[spamrules_statement_ifinbag|IfInBag]] * [[spamrules_statement_iflocaladdress|IfLocalAddress]] * [[spamrules_statement_ifmatch|IfMatch]] * [[spamrules_statement_include|Include]] * [[spamrules_statement_loadbag|LoadBag]] * [[spamrules_statement_log|Log]] * [[spamrules_statement_random|Random]] * [[spamrules_statement_redirect|Redirect]] * [[spamrules_statement_reject|Reject]] * [[spamrules_statement_removebag|RemoveBag]] * [[spamrules_statement_removebayesham|RemoveBayesHam]] * [[spamrules_statement_removebayesspam|RemoveBayesSpam]] * [[spamrules_statement_removeblacklist|RemoveBlackList]] * [[spamrules_statement_removetags|RemoveTags]] * [[spamrules_statement_removewhitelist|RemoveWhiteList]] * [[spamrules_statement_replace|Replace]] * [[spamrules_statement_sendmessage|SendMessage]] * [[spamrules_statement_startdns|StartDNS]] * [[spamrules_statement_startdnsbl|StartDNSBL]] * [[spamrules_statement_startsurbl|StartSURBL]] * [[spamrules_statement_stop|Stop]] * [[spamrules_statement_surbl|SURBL]] * [[spamrules_statement_winhttpget|WinHTTPGet]] * [[spamrules_statement_zipcontents|ZipContents]] * [[spamrules_statement_zipcontentsfull|ZipContentsFull]] * [[spamrules_statement_zipcount|ZipCount]] * [[spamrules_statement_zipfile|ZipFile]] =====Examples===== * [[spamrules_addrandomtexttosubject|Add random text to subject on incoming messages]] * [[spamrules_addfixedtexttosubject|Add fixed text to subject on incoming messages]] * [[spamrules_checkrecipient|Increase spam score for specified recipients]] * [[spamrules_longsenderdomain|Increase spam score for long sender domains]] * [[spamrules_manylinks|Increase spam score for many links in the email]] * [[spamrules_subject|Increase spam score for subject marker]] * [[spamrules_header|Increase spam score for spam header marker]] * [[spamrules_ipwhitelist|Allow messages through from a specific IP address]]