This is an old revision of the document!
Table of Contents
Overview
Filters are normally edited in the user interface, in the window that appears when the File→Filters command is run. Once defined, they are applied server-side by manitou-mdx to messages that enter the database.
A filter is defined to apply to incoming or outgoing mail or both. Applying a filter consists of evaluating its condition, and if the result is true, doing the actions that are associated to it. If a filter has no action, it can be considered inactive. A condition is basically an expression that evaluates to true or false, optionally qualified with a unique name, that can be self-contained or refer to another expressions.
Expressions syntax
The expressions can be arbitrarily complex, with subparts combined with NOT, OR, AND boolean operators, references to other expressions, calls to built-in functions and evaluation of built-in operators. An expression may be named and refered to by its name from another expression.
expr := expr op expr expr := (expr) expr := NOT expr op := OR | AND | contain[s] | eq[uals] | regmatches | ne expr:= function(expr)
Functions
As of 0.9.11, built-in functions are:
- rawheader(string name): returns the non-decoded form of the first occurrence of the header line
name
- header(string name): returns the decoded form of the first occurrence of the header line
name
- headers(): returns the entire headers of the message
- rawheaders(): returns the entire non-decoded headers of the message
- recipients(): returns all recipients (To, Cc, Bcc) separated by commas
- body(): returns the text body of the message
- mailbox(): returns the name of the mailbox to which the message belongs
Examples
Restrictions
As of 0.9.11
- Filters can't be applied retroactively, that is, applied to messages that existed before the filter was defined or modified.
- A user can't change the order of the conditions with the UI.
- The UI doesn't check the expressions for correctness, nor provides any way to test filters. If an expression is invalid and gets used by manitou-mdx during the filtering step, only then will it fail.