Synopsis:require "test-numaddr"; ... if numaddr args { ... }
Description: This test is provided as an example of loadable extension tests. You must use ‘require "test-numaddr"’ statement before actually using it.The
numaddrtest counts Internet addresses in structured headers that contain addresses. It returns true if the total number of addresses satisfies the requested relation.If the tagged argument is ‘:over’ and the number of addresses is greater than count, the test is true; otherwise, it is false.
If the tagged argument is ‘:under’ and the number of addresses is less than count, the test is true; otherwise, it is false.
If the tagged argument is not given, ‘:over’ is assumed.
Synopsis:require "test-spamd"; ... if spamd args { # This is spam ... }
Description: This test is an interface to SpamAssassin filter. It connects to the spamd daemon using connection parameters specified by tagged arguments:hostand:port(if the daemon is listening on an INET socket), or:socket(if the daemon is listening on a UNIX socket) and returns true, if SpamAssassin qualifies the message as spam. Tagged argument limit alters the default behavior. Its value is a string representation of a floating point number. If the tag:overis used, then the test returns true if the spam score returned from SpamAssassin is greater than limit. Otherwise, if:underis used, the test returns true if the spam score is less than limit. The comparison takes into account three decimal digits.Tagged argument
:userallows to select a specific user profile. If it is not given, the user name is determined using the effective UID.Before returning, the
spamdtest adds the following headers to the message:
- X-Spamd-Status
- ‘YES’ or ‘NO’, depending on whether the message is qualified as spam or ham.
- X-Spamd-Score
- Actual spam score value.
- X-Spamd-Threshold
- Spam score threshold, as configured in SpamAssassin settings.
- X-Spamd-Keywords
- Comma-separated list of keywords, describing the spam checks that succeeded for this message.
Example:request "test-spamd"; if spamd :host 127.0.0.1 :port 3333 { discard; }
Synopsis:require "test-list"; if list args { ... }
Description: Thelisttest evaluates to true if any of headers match any key from keys. Each header is regarded as containing a list of keywords. By default, comma is assumed as list separator. This can be overridden by specifying the:delimtag, whose value is a string consisting of valid list delimiter characters.
Example: This test can be used in conjunction with thespamdtest described above:require ["fileinto", "test-spamd", "test-list"]; if spamd :host 127.0.0.1 :port 3333 { if list :matches :delim " ," "X-Spamd-Keywords" [ "HTML_*", "FORGED_*" ] { fileinto "~/mail/spam"; } else { discard; } }
Synopsis:require "test-timestamp"; if timestamp arg { ... }
Description: Thetimestamptest compares the value of a structured date header field (header) with the given date (date).If the tagged argument is
:afterand the date from the header is after the specified date the result is true, otherwise, if the header date is before the given date, the result is false.If the tagged argument is
:beforeand the date from the header is before the specified date the result is true, otherwise, if the header date is after the given date, the result is false.If no tagged argument is supplied,
:afteris assumed.Almost any date format is understood. See Date Input Formats, for a detailed information on date formats.
Example: The test below succeeds if the date in ‘X-Expire-Timestamp’ header is more than 5 days older than the current date:require "test-timestamp"; if timestamp :before "X-Expire-Timestamp" "now - 5 days" { discard; }