Skip to content

Rules and auto-repliesEmail filtering (Sieve)

Email filtering (Sieve)

Sieve is a language for filtering email on the server. Its rules run on the mail server before mail reaches your email app, so they work even when your device is offline.

Most people should use inbox rules in the dashboard, API, or MCP. Use Sieve when you want to write the filter script yourself.

Last updated

Which automation to use

  • Out of office for vacation and out-of-office replies.
  • Inbox rules for sorting, marking, and starring by fixed conditions, through the dashboard, API, or MCP.
  • AI assistant automations for AI workflows you create in the AI assistant or the Automations tab.
  • Sieve for server-side filter scripts you write yourself.

Uploading a script

Upload and activate a script with the JMAP method SieveScript/set (RFC 9661) at https://mx1.shipmail.to/jmap, with your full email address and the mailbox password. Shipmail no longer runs a ManageSieve server (port 4190), so ManageSieve clients such as the Thunderbird Sieve add-on cannot connect.

App passwords cannot manage Sieve scripts, because a script can forward every message. Owners get an email when forwarding is added in Shipmail, and a script uploaded with an app password would skip that alert.

When a script you upload becomes the active one, the Owner gets an email that names the script and the mailbox, and the audit log records it. Shipmail checks every mailbox at least once a day, and alerts again each time a new version of the script is uploaded. It never turns off or deletes your script. Shipmail owns the names shipmail and vacation: a script you upload under one of them also alerts the Owner, and Shipmail replaces it with its own.

Example filters

Move newsletters to a folder

require ["fileinto"];
if header :contains "List-Unsubscribe" "" {
  fileinto "Newsletters";
}

Vacation reply

require ["vacation"];
vacation :days 7
  :subject "Out of office"
  "I am currently out of the office.
I will reply when I return.";

Discard email from a specific sender

if address :is "from" "spam@example.com" {
  discard;
}

Sort subaddressed email into folders

require ["fileinto", "envelope", "subaddress"];
if envelope :detail "to" "github" {
  fileinto "GitHub";
}
if envelope :detail "to" "newsletters" {
  fileinto "Newsletters";
}

Supported extensions

Shipmail supports these Sieve extensions: fileinto, reject, vacation, envelope, subaddress, body, regex, copy, imap4flags, variables, include, and editheader. The JMAP session lists every capability it supports.