Skip to content

Add visual server-side mail rules using JMAP Sieve #128

Description

@BYK

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Estimate

    None yet

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions