[NOTICE] New account registration is currently closed. Existing members are unaffected.
itpromail
home / docs / filtering

Sieve filters: introduction and activation

Sieve is a standard mail filtering language (RFC 5228). ITProMail runs your Sieve scripts on the server when mail arrives, so the rules apply to every client, including webmail and phones, and do not depend on your computer being on. Sieve is available on the Operator and Shadow plans, and each account can store up to 10 scripts.

Where filters live

Open Account > Filters to create, edit and activate scripts. A script is a set of rules. Rules run from top to bottom, and each incoming message passes through the script once.

Syntax basics

  • Commands end with a semicolon.
  • Strings are enclosed in double quotes.
  • A script that uses extensions starts with a require line that lists them. Core actions such as keep, discard and stop need no entry.
  • Conditions use if, elsif and else. Actions go inside braces.
  • Comments start with #.
  • Header tests are case-insensitive by default.

Common tests include header, address, size, exists, anyof, allof and not. Common actions include fileinto (file into a folder), redirect (forward), discard (drop silently), keep (deliver to Inbox), stop (end processing) and vacation (automatic reply).

A small first script looks like this:

require ["fileinto"];

# Send list traffic to its own folder
if header :contains "List-Id" "dev.example.org" {
    fileinto "Lists";
}

Create and activate a script

  1. In Account > Filters, create a new script and give it a name that describes its purpose.
  2. Write or paste the rules. Keep scripts short and comment them.
  3. Create any folders the rules file mail into before you activate the script, so mail lands where you expect.
  4. Save the script, then activate it. Sieve allows only one active script at a time, so activating a script replaces the one that was active before. Keep all your rules in that script, or merge them into it.

Test before you rely on it

Send a test message from another address that should match the rule, then check the target folder. Look at the raw headers of a real message to confirm the exact header name and value you are matching. Start with narrow conditions. A rule that matches too broadly can file or discard real mail.

Next steps

See Sieve examples for ready-made rules, and forwarding and automatic replies for the redirect and vacation actions.