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

Sieve Filter Recipes for Sorting, Vacation Replies and Plus Addresses

Working Sieve rules for sorting mail, sending vacation notices and routing plus-addressed mail, with notes on order, testing and common mistakes.

July 16, 2026 · Guides · ITProMail team

Sieve is a standardized language for server-side mail filtering, defined in RFC 5228 with extensions for folders, vacation replies and address parts. Rules run on the server when mail arrives, so they apply to every client and device. On ITProMail, Sieve scripts are managed under Account > Filters, and Sieve is included on the Operator plan. An account can hold up to 10 scripts. The recipes below use standard extensions and example addresses only.

How the pieces fit

A Sieve script begins with a require line that declares every extension it uses. Each rule is an if test followed by an action. The fileinto action files a message into a folder. Once a message is filed with fileinto, the implicit keep is cancelled, so the message does not also land in the Inbox. Rules run top to bottom. A later rule can see a message that an earlier rule has already filed, so order matters. Use stop; after an action when a message should not be processed further.

Recipe 1: Sort a mailing list by List-Id

Mailing lists usually add a List-Id header. Matching on it is more reliable than matching the sender address, which can change.

require ["fileinto"];

if header :contains "list-id" "announce.example.com" {
    fileinto "Lists";
    stop;
}

Folder names with a hierarchy depend on the server's separator character, so a single flat folder name is the safest choice unless you have confirmed the separator.

Recipe 2: File receipts by sender domain

The address test with the :domain part matches the domain of the sender address, which avoids accidental matches on the display name.

require ["fileinto"];

if address :domain :is "from" "billing.example.net" {
    fileinto "Receipts";
}

Use :is for an exact domain match. Use :contains carefully, because it will also match longer domains that include the same text.

Recipe 3: Route plus-addressed mail

ITProMail supports plus-addressing, so a message sent to you+shopping@itpromail.com can be identified by its tag. The :detail address part requires the subaddress extension.

require ["fileinto", "subaddress"];

if address :detail "to" "shopping" {
    fileinto "Shopping";
    stop;
}

if address :detail "to" "newsletters" {
    fileinto "Newsletters";
    stop;
}

A tag per sign-up is a simple way to see which service leaked your address. Pair it with the aliases described in the aliases guide when you need a separate address rather than a tag. Plus-addressing is covered in the subaddressing guide.

Recipe 4: Vacation notice

The vacation action from RFC 5230 sends an automatic reply. It should be set with a limited re-reply interval, and it should name every address that can receive mail for you.

require ["vacation"];

vacation :days 7 :subject "Out of office"
  :addresses ["you@example.com", "you@example.org"]
  "I am away until 3 November and will reply when I return. For urgent matters, contact support@example.com.";

The :days value controls how often a given sender receives the reply. The :addresses list tells the server which recipient addresses are yours, so a reply is not sent for mail addressed to someone else. Vacation replies should not be sent to bulk or list traffic, and compliant implementations avoid doing so. Check your own test results rather than assuming.

Recipe 5: Combine sorting and vacation safely

A reply to every sender can be noisy. If you combine a vacation notice with the list recipe above, keep the list rule first and stop, so list mail is filed and never reaches the vacation action. That order keeps replies to personal correspondence only.

Testing and common mistakes

  • Typos in folder names. A misspelled folder name either creates a new folder or fails. Check the Filters page for errors before enabling a script.
  • Missing require lines. Every extension used must be declared, or the script will be rejected.
  • Trash as a target. Trash is emptied after 14 days on ITProMail, so filing mail there risks losing it. Use a dedicated folder for anything you want to keep.
  • Overlapping rules. Keep each rule single-purpose and test the order with a message you send to yourself, then check the folder it lands in.
  • Vacation loops. Always set a re-reply interval and never reply to automated mail.

Keep the scripts simple

Sieve is intentionally small, which makes scripts easy to audit. Keep a copy of each script outside the server, record what each rule is for, and review them when you change aliases or addresses. A forwarding action, if you use one, should be reviewed with the same care as any other route for mail, as described in the forwarding and auto-reply guide. The Sieve guide and the Sieve examples cover the rest of the platform's behavior.

Related reading