Table of Contents

Spam Filter Rules: Variables

The VPOP3 spam filter script language supports simple variables. In most places these are specified as ${<variable name>}, but in some places they are just specified as <variable name> - for instance where a statement always puts its result into a variable.

All variables are typeless, so the same variable can contain either a text or a number, and conversion between the two types will take place automatically as required. Arrays of variables are not supported.

The variable name is case insensitive, so ${MailFrom} and ${mailfrom} refer to the same variable.

Built-in variables

VPOP3 has several built-in variables which can be treated like any other:

Variable name Description Version
${MailFrom} The SMTP return address of the message 2.1.7+
${RcptCount} The number of recipients which VPOP3 knows about (from the SMTP envelope or recognised addresses in the message header) 2.1.7+
${SenderIP} The sender's IP address (for SMTP mail only) 2.1.7+
${Subject} The subject of the message 2.1.7+
${MatchedConditions} A list of the currently matched rules 2.1.7+
${Size} The raw size of the message 2.1.11+
${AttachmentCount} The number of attachments in the message 2.1.11+
${InlineAttachmentCount} The number of 'inline' attachments in the message (eg inline images etc) 2.1.11+
${VPOP3Build} The currently running 'build number' of VPOP3 - you can find this on the About (previously Info) page in the VPOP3 settings 2.2.1+
${WeightBank} The current values to use for a particular rule - see DefineRule 2.2.1+
${RegExMatches} The number of regular expression matches from the last match expression 2.2.1+
${<n>} e.g. ${1} - The result of the previous regular expression match corresponding to the specified number. e.g. ${0} gives the full string which matched the previous regular expression, ${1} gives the string which matched the first parenthesised expression in the previous regular expression, and so on.2.2.1+
${Weight_<name>} The currently configured weight for a particular setting 2.2.1+
${DNSServers} The DNS servers to use for DNS lookups 2.3.0+
${BayesSize} The number of messages the Bayesian database covers 2.3.0+
${SectionCheckSize} The maximum size of a message section to check (default is 50,000) 2.3.9+
${CanChangeCheckSize} Returns '1' if this version of VPOP3 allows the script to change the ${SectionCheckSize} value 2.3.11+
${AuthSender} Returns the authenticated sender's username if the message is received using SMTP 2.4.5+
${AnyInvalidRecipients} Returns '1' if any recipients of the message are non-existent local users 2.4.7+
${VPOP3Version} The current VPOP3 version number (eg “6.15”) 6.0
${BATV} Whether BATV is used (SMTP msgs only) 0 or 1 6.15
${SPFResult} SPF test result (SMTP msgs only) 6.15
${DKIMResult} DKIM test result (SMTP msgs only) 6.15
${SMTPHelo} SMTP Helo String (SMTP msgs only) 6.15
${SMTPReverseDNS} Reverse DNS of SMTP client (SMTP msgs only) 6.15
${DMARCResult} Result of DMARC test (SMTP only) - pass,fail,temperror,permerror 7.8
${DMARCDisposition} Policy result of DMARC (SMTP only) - none, reject, quarantine 7.8
${DMARCDomain} Policy domain of DMARC (SMTP ony) 7.8
${TimeNow} Time now in ISO-8601 (Zulu) format 8.6
${TimeNowDays} Time now in fractional days since 1st Jan 1601 8.6
${RFC822TimeNow} Time now in RFC 822 Date header format 8.6

Bags

The VPOP3 spam filter script language also supports 'Bags' which can contain collections of data. See AddBag, RemoveBag, IfInBag, ForEach Bag and ClearBag.

'Bags' are similar to “Arrays” or “Sets” in other languages in that they can store multiple items of data, however the data cannot be accessed individually, you can use ForEach Bag to iterate through the data, or IfInBag to check if a specific item exists in the data.