Blog > How do server side (sieve) filters work again?

How do server side (sieve) filters work again?

Kolab Now offers a mail filtering feature. That makes it possible to apply a series of actions to specifically selected incoming emails, so that incoming mail meeting a certain criteria can be automatically processed by the server and handled/organized according to the defined actions. For example the server can move the message to a specified folder, redirect it to another account, send a reply, discard, delete, etc for as long as the defined criteria is fulfilled.

Filtering is based on the Sieve language, which means that under the hood all filters are stored in one or more Sieve scripts on the server. The filters can be managed through the Kolab webclient Filter interface ( ‘-> Settings -> Filters’). It allows a user to define rules and actions in an easy way without the need to know the language.



















Filter sets

Filters are grouped into sets. These can be activated or deactivated. Depending on the server configuration there can be none, one or more active sets at the same time. Filter sets (scripts) need to have a unique name. Each filter set is equal to a Sieve script file on the server.

There is a limit to the size of the Sieve script files. Depending on the complexity of the rules and actions in the filters, a filter set can contain around 8 filters. The more rules and actions in the filters, the less filters can be fit into one filter set.

New filter sets can be created as empty or as a copy of an existing set. It is also possible to import them from a text file containing a Sieve script. Sets (or scripts) can be downloaded e.g. for backup or migration purposes.

A user can have multiple filter sets (scripts) defined. Those gets examined one by one from the top down at runtime.

Filter definition

Every filter can be active or inactive, which is convenient if you want to disable some actions temporarily. In case a filter set is not working please always double check if it is enabled/disabled via the actions menu in the top next to the settings section (even when stated ‘Filter enabled’ on the right).

Filters are executed in a specified order (from top to bottom as you see them on the list). It is possible to use the drag-and-drop technique to rearrange filters on the list.

Good to know

When the examination hits a positive on a rule in a filter, it executes the actions in that filter. If the action list ends with a ‘Stop’, the system moves on to the next mail. Otherwise it reads the full list of filters and evaluate the other filters against this email. This can create some confusion and prevent the system from working.
This means, that if one wants the system to evaluate mails against one filter before another, then the order needs to be right. Also, it is a good practice to end action lists with the ‘Stop’ action.

Every filter definition contains at least one rule and one action. Depending on the server capabilities a rule can be based e.g. on the message headers, body, date, size or other criteria.

The set of actions depends on the server capabilities. The Kolab Now webclient filter interface supports:

  • moving/copying messages to specified folder
  • redirecting/copying messages to another account
  • discarding messages with specified error message
  • replying (vacation)
  • deleting (ignoring) messages
  • setting/removing flags (e.g. marking as Read)
  • Keeping message in inbox
  • Stop evaluating rules

Troubles with filters?

Copy the filter text (via ‘Settings -> Filters -> Actions -> Edit filter set’).  Copy and paste the full script (the text in the right side screen) into a mail to