An expression (filtering expression) is composed of a header name, an operator and an optional value. The expression can be applied to a mail message and will give a matching/unmatching response.
A filter contains the following:
- Name
- Priority
- Enabled/Disabled state
- ExpressionOperator: operator to compose multiple filtering expressions (And/Or)
- Expressions
- Actions
- Header: the mail message header the expression to witch the matching criteria will be applied
- Operator: operator specific to the header type
- Value(optional): a value that the operator may need (depends on the operator)
Supported Headers/Operators/Values
| Header(s) | Supported operators (negated or not) |
Supported values | Comments |
| Subject To To or Cc Cc Custom |
Contains Is Begins with Ends with |
String | When Custom is selected the name of the custom header must be specified. |
| From | Contains Is Begins with Ends with |
String | |
| Size | Is greater than Is lower than |
String describing size, e.g.: 1024 (bytes) 1K (1 kilobyte = 2^10 bytes 1M (1 megabyte = 2^20 bytes) 1.4G (1.4 gygabytes = 1.4 * 2^30 bytes) |
Action Data
| Action | Data | Type | Description |
| Move | to | string | The path to the location is given as UTF8 |
| Copy | to | string | The path to the location is given as UTF8 |
| Delete (move to trash) |
(none) | (none) | The message will be moved to trash. |
| Forward | to | email address | The message will be forwarded to the given email address. No copy will be saved. |
| Vacation | days | number | mininum > 0 maximum > 7 (must) maximum > 30 (should) if omitted, days defaults to 7 or minimum (whichever is greater) if given value > maximum, days defaults to maximum if given value < minimum, days defaults to minimum |
| subject | string (utf8) | Alternate subject for response. If not given, the incoming mail's subject is used |
|
| text | string (utf8) | Body of the response message. |
Filter Container
The FilterContainer is responsible for serializing an ordered collection of filters into a file and for parsing a sieve script that contains one or more filters.
The parts of the scripts that are not recognized are stored as raw text in memory. When doing the serialization, the container will reorder the scripts. The ones that were edited by WebMail will be written at the beginning of the file while all 'raw' scripts will be written at the end.
A script is recognized as being a WebMail script if:
- contains only directives that have been implemented in WebMail filters
- has a header with the following data:
- Name: user specified string
- Id: internal integer to uniquely identify the script
- Position: integer used for ordering the scripts
- Enabled: boolean
If the script does not have a header but can be handled as a WebMail script it will be given an auto-generated id, a last position in the list and an auto-generated name.










