Manitou-Mail Home

1. Expressions syntax

1.1. Literal constants

Numbers must be positive integers in base 10. When a number is immediately followed by the letter K, it is multiplied by 1024 (for kilobytes). When it is immediately followed by the letter M, it is multiplied by 1024*1024 (for megabytes), and when followed by G, it is multiplied by 1024*1024*1024 (for gigabytes). The letter after the number can be uppercase or lowercase.

Strings must be enclosed between double quotes or single quotes. If the first character is a single quote, double quotes can be used in the string as normal characters (example: 'Result of "command"'). Conversely, if the first character is a double quote, single quotes can be used normally inside the string (example: "Scarlett O'Hara")

A string may also contain the enclosing character itself. In this case, the entire string must be started by a backslash before the single or double quote, and each non-terminating occurrence of the enclosing character inside the string must be preceded by a backslash. In addition, to represent a backslash itself in such a string, the backslash character must be doubled. For example, a regexp that matches single or double quotes could be written as: "[\"\']"

1.2. Operators

Table XI.1. Operators for filter expressions

OperatorExampleDescription
!!condition("urgent")Logical inverse of the operand. Equivalent to not.
=
is
header("Precedence")="bulk"Test for the case insensitive equality of two strings. ("A"="a" is true).
isnotto isnot "me@example.com"This is the logical inverse of the is operator.
eqheader("Precedence") eq "bulk"Test for the exact equality of two strings (case sensitive).
neheader("Precedence") ne "bulk"This is the logical inverse of the eq operator (case-sensitive equality of strings).
contain
contains
header("from") contains "@example.net"True if the left operand contains the right operand, case insensitive.
!=now("month")!=12Test for the inequality of two numeric values.
==date("weekday")==1Test for the equality of two numeric values.
<
<=
>
>=
age("days")>=2Compare two numeric values, testing for lower, lower or equal, greater, greater or equal.
=~header("subject") =~ "^\[URGENT\]"True if the left operand matches the regular expression in the right operand, case insensitive.
!~header("subject") !~ "^\[URGENT\]"True if the left operand does not match the regular expression in the right operand, case insensitive.
regmatchesheader("subject") regmatches "^\[URGENT\]"True is the left operand against the regular expression matches the right operand, case sensitive.
andfrom is "a@example.com" AND to is "b@example.com"True if both the left operand and right operand evaluate to true.
orfrom is "a@example.com" OR from is "b@example.com"True if either of the left operand or right operand evaluate to true.

Arbitrarily complex expressions can be written by combining conditions and operators and nested parentheses. Example:

(pg_gen OR pg_interf) AND NOT (header("From") contains "@example.org")

All the expressions that have at least one action connected to them are evaluated, unless the "Stop filters" action gets triggered.