thunderbird / thunderbird/stormbox

Add visual server-side mail rules using JMAP Sieve

Open
#128 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
105
Forks
9
Avg merge
18h 18m
Merged PRs (30d)
16

Description

Summary

Add a visual Mail Rules editor to Stormbox that creates server-side filters through JMAP for Sieve.

This follows the contributor direction on the [Thundermail Ideas proposal](https://ideas.tb.pro/p/visual-server-side-mail-rules-using-jmap-sieve). A working prototype is available on https://github.com/BYK/stormbox/tree/feature/mail-rules-jmap-sieve and is also deployed at https://webmail.byk.im/ and tested successfully.

There can be UX follow-ups such as auto-complete for email addresses or criteria previews but I think this is a good first pass.

Why

Server-side rules keep working when Stormbox is closed and apply consistently across every mail client. Thundermail’s backend already exposes JMAP for Sieve, but users currently need another client or manually authored Sieve to configure filtering.

Proposed experience

Users can create, edit, enable, disable, reorder, and delete ordered rules with:

  • Conditions: From, To, To/Cc, Subject, and custom headers
  • Matching: is, contains, and wildcard
  • Multiple conditions using all or any
  • Actions: move to folder, mark as read, star, forward a copy, discard, and stop processing

Implementation approach

Keep the feature browser-side and use Stormbox’s existing authenticated JMAP connection, SharedWorker, and durable mutation outbox:

  • Store rules as a typed, versioned document and compile them into a deliberately limited Sieve subset.
  • Detect advertised Sieve extensions and expose only supported actions.
  • Upload and validate scripts through JMAP for Sieve before activation.
  • Target folders using stable JMAP mailbox IDs.
  • Clearly mark Stormbox-managed scripts and retain the visual rule document as metadata.
  • Preserve scripts owned by other clients and require explicit confirmation before replacing an externally managed active script.
  • Detect concurrent server changes rather than silently overwriting them.

Acceptance criteria

  • Rules can be created, edited, reordered, enabled, disabled, and deleted.
  • Generated Sieve is server-validated before activation.
  • Existing external scripts are preserved unless replacement is explicitly confirmed.
  • Concurrent server changes are detected.
  • The feature is unavailable when JMAP Sieve is unsupported.
  • Compiler, store, sync, component, and end-to-end coverage is included.

Initial non-goals

  • Raw Sieve editing or importing arbitrary Sieve
  • Retroactively applying rules to existing messages
  • Shared-account rule management

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining Stormbox’s existing authenticated JMAP connection, SharedWorker, and durable mutation outbox, then compare the working prototype linked in the issue. Done means the visual rule lifecycle works, Sieve is validated before activation, external and concurrent scripts are protected, unsupported servers disable the feature, and compiler, store, sync, component, and end-to-end coverage is included.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design, full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.