Blog/ Other providers

How to Create Rules in Fastmail (Including Custom Sieve)

Nafiul HasanNafiul Hasan· 8 min read
Diagram of a Fastmail rule matching an incoming message and filing it into a folder, with a custom Sieve script running alongside it

The short answer

Go to Settings → Filters & Rules, click Create rule, set a condition and an action, then save. Drag rules to reorder them — Fastmail checks blocked senders and spam protection before any rule runs. The builder covers most filing. Custom Sieve, edited from the same screen, is for logic the builder can't express, like time-based conditions.

How to create and order rules in Fastmail, plus when to drop into custom Sieve for logic the rule builder can't express.

On this page
  1. 01Before you start
  2. 02Steps to create a Fastmail rule
  3. 03When the rule builder isn't enough: custom Sieve
  4. 04Where you manage Fastmail rules, and why it matters
  5. 05What to do when a Fastmail rule doesn't fire
  6. 06A faster way to keep filing right as your inbox changes

To create a rule in Fastmail, go to Settings → Filters & Rules and click Create rule, add one or more conditions, choose what happens when a message matches, then save. Rules run in the order they're listed in that screen, and you can drag any rule up or down to change when it fires.

Most everyday filing needs nothing more than that builder — moving a newsletter into its own folder, auto-labeling a client's mail, forwarding invoices to a bookkeeper. Custom Sieve is the escape hatch for logic the builder doesn't expose: matching on a header the condition list doesn't offer, or filtering by time of day. This post covers both, plus the ordering detail that explains most "my rule isn't firing" reports — Fastmail checks blocked senders and spam protection before your rules ever see the message.

Before you start#

A rule needs three things: a condition Fastmail can test against every incoming message, an action to take when it matches, and a target — a folder that already exists, or an address you're allowed to forward to. Create the folder first if you're filing into something new; the rule builder won't create one for you.

Decide whether you're matching on a sender address, a domain, a subject phrase, or a recipient address (useful if you use address aliases or plus-addressing to sort mail by which alias received it). A domain match is usually more durable than an exact sender address — it survives a company switching who sends its invoices.

  • The target folder or label already exists
  • You know whether you're matching sender, domain, subject, or recipient
  • You have the exact forwarding address, if the rule sends a copy elsewhere

There's a ceiling, but it's generous

Fastmail allows up to 1,000 rules per account and up to 50 conditions inside a single rule. Almost nobody hits either limit — if you're approaching it, a handful of domain-level rules usually replace a long list of sender-specific ones.

Steps to create a Fastmail rule#

  1. 1

    Open Filters & Rules

    In Settings, go to Filters & Rules and click Create rule. You can also start a rule from an open message (Actions menu → Add rule from message) or from a search, but the Settings screen is the only place you can preview which existing messages match before you save.

  2. 2

    Add a condition

    Click Add condition and choose what to match — sender, sender domain, recipient, subject, or another field. Add more conditions if you need an AND match; the builder lets you stack up to 50 per rule, though most rules need one or two.

  3. 3

    Click Continue to preview matches

    Fastmail shows which existing messages fit the condition before you commit. Use this step to catch a condition that's broader or narrower than you intended, rather than finding out after mail has already moved somewhere unexpected.

  4. 4

    Choose the action and save

    Pick what happens on a match: move to a folder, mark read, pin, notify you, snooze until a set time, send a copy to another address, delete to trash, or send to spam. Name the rule so you can find it later, then click Save.

  5. 5

    Reorder if you have overlapping rules

    Drag rules in the list to set the order they run in. If two rules could both match one message, the one listed first runs first — and a rule further down the list can still act on the same message afterward, so put the more specific rule above the broader one that would otherwise catch it first.

When the rule builder isn't enough: custom Sieve#

The rule builder generates a Sieve script behind the scenes for every rule you create — Sieve is the filtering language Fastmail's mail servers actually run. For most people that's invisible. It stops being invisible when you need something the builder has no condition for: a time-of-day rule, matching against a header the UI doesn't list, or chaining a sequence of actions the builder can't express in one rule.

To reach it, open Settings → Filters & Rules and click Edit custom Sieve code at the bottom of the screen. You'll see the Sieve that your existing rules already generated — a useful way to learn the syntax by reading code you already understand the intent of. Sieve runs top to bottom, and you can place your own code above or below the block Fastmail generates for spam protection, which decides whether your custom logic sees a message before or after spam filtering has judged it.

A concrete example: the rule builder has no "only match outside business hours" condition. Sieve's date extension does — a script can test the current hour and only act on messages arriving before 9am or after 6pm, something no combination of sender and subject conditions can express in the UI. That's the kind of rule worth writing by hand; everything filed by sender or domain belongs in the builder instead, where it's easier to read and edit later.

Where you manage Fastmail rules, and why it matters#

WhereWhat it controlsWhat it doesn't do
Fastmail web app (or the iOS/Android apps, which open the same settings)The full rule builder and the custom Sieve editor. Changes take effect on Fastmail's servers immediately.Nothing — this is the source of truth for every rule and applies no matter which app you read mail in.
Outlook, Apple Mail, or any app connected over IMAPThat app's own client-side filters, if it has them.Client-side rules run only inside that one app on that one device. They don't move mail on Fastmail's server, and they don't apply if you check mail from your phone's browser instead.
Custom Sieve scriptServer-side logic beyond what the builder exposes, same execution layer as UI rules.Doesn't replace the rules you've already built — it supplements them, in whatever position you place the code.

What to do when a Fastmail rule doesn't fire#

A rule that looks correct and still doesn't act on a message almost always comes down to one of a few causes. Check these in order before assuming the rule itself is broken.

Illustration of incoming mail being sorted into separate bins by rule conditions, representing how a Fastmail rule files messages into folders
Rule order decides which bin a message lands in when more than one rule could match it.
CauseHow to fix it
Spam protection caught the message firstFastmail processes mail in this order: blocked senders, then spam protection, then address actions, then your rules. A message already flagged as spam never reaches your rule. Check the Spam folder before anything else.
An earlier rule already moved itIf a rule above yours in the list matched the same message and moved it, your rule may never see it in the state you expect. Reorder your rule higher, or narrow the earlier rule's condition.
The condition doesn't match what you think it doesA sender uses a subdomain or an alias your condition doesn't cover. Use search with the same terms first to confirm which messages actually match before you save the rule.
The action didn't save the way you expectedReopen the rule in Filters & Rules and confirm it shows the folder or action you intended — easy to select the wrong one in a long folder list.
You're reading mail in a separate IMAP appA Fastmail rule already filed the message on the server before Outlook or Apple Mail downloaded it, or the app's own client-side filter is competing with it. Check the server-side result in the Fastmail web app first.

A faster way to keep filing right as your inbox changes#

Rules and Sieve scripts are exact but static — they file mail precisely how you wrote them, and precisely nothing more, until you go back and edit them. A new client, a newsletter that switches its sending domain, a vendor that starts using a new subdomain: none of that updates your rule on its own.

We build AI Emaily, an AI email client that connects to accounts like Fastmail and layers continuous triage on top of the filing you've already set up — instead of a fixed condition written once, it reads new mail against your filing patterns and asks before moving anything you haven't approved. Your Fastmail rules and Sieve script keep running exactly as they do today; this covers the judgment calls a static condition can't make. See how it works at /features/rules-brain.

Frequently asked

Nafiul Hasan

Written by

Nafiul Hasan

Nafiul Hasan is an entrepreneur and AI automation system builder with 10+ years of experience turning messy, manual workflows into reliable automated systems. He designs and ships AI enterprise solutions end-to-end — the agent logic, the data plumbing, and the product people actually use — and founded AI Emaily to give busy professionals their attention back. He writes here from the builder's seat: what works, what breaks, and how to put AI to work without giving up control.

EntrepreneurAI Automation System BuilderAI EnthusiastBuilds AI Enterprise Solutions10+ years experience
More from Nafiul
Ready when you are

Set the rules once, let AI Emaily handle the judgment calls

AI Emaily connects to your Fastmail account and keeps filing right as your inbox changes — start a 7-day free trial.

  • 7-day free trial
  • Cancel anytime
  • Every provider