MAIL: Fastmail uses JMAP automatically (token auth, delta sync, push), same cache as IMAP #614

Open
opened 2026-10-01 09:53:49 +00:00 by kayg · 0 comments
Owner

Owner request (2026-10-01): "for fastmail we should auto support JMAP instead of IMAP"

Fastmail offers JMAP (RFC 8620 core, RFC 8621 mail), which is faster and simpler to sync than IMAP: one HTTPS session, push via EventSource, state strings for delta sync (Email/changes, Mailbox/changes), batched method calls, and server-side threading.
Build:

  • Auto-detect: when a User connects a Fastmail account (by provider, or any account whose domain advertises JMAP via /.well-known/jmap), use JMAP automatically, with no setting to pick. Fall back to IMAP only if JMAP discovery fails.
  • Auth: Fastmail JMAP uses an API token (Settings → Privacy & Security → API tokens, scope Mail; read-only or read-write). The Connected Accounts form for Fastmail asks for that token instead of an app password, with a plain how-to link and wording. Store it like other credentials (encrypted, never logged). Same Connected Account row (#407).
  • Sync engine: a JMAP adapter behind the same Mail cache/store as IMAP (reuse: mailboxes → mail_folders, Email → mail_messages, threads, keywords → flags), so the UI, search and CalternalDAV mail proxy (#486) need no changes.
    • Initial sync: Email/query newest first in pages + Email/get with header/preview properties (bodies lazily).
    • Delta: Email/changes / Mailbox/changes from the stored state.
    • Push: EventSource with types=Email,Mailbox; reconnect with back-off.
    • Writes (flag/move/delete) go through Email/set, and sending (later) through EmailSubmission/set.
  • Speed budget (the owner wants Mail "crazy fast"): the first 100 newest Inbox messages visible ≤ 2 s after connecting; full header backfill streams in the background with progress; push latency ≤ 2 s.
  • Tests: an integration test against a JMAP test server (e.g. a local Stalwart or a recorded-fixture server), covering the initial page, delta, push, flag/move round-trip, and token revocation → a plain error. Real Fastmail verification by the owner (they provide the token in the UI; never in logs or issues).
    Order: after the IMAP first-sync bug (#613) is fixed. It reuses the Connected Accounts structure (#407).
## Owner request (2026-10-01): "for fastmail we should auto support JMAP instead of IMAP" Fastmail offers **JMAP** (RFC 8620 core, RFC 8621 mail), which is faster and simpler to sync than IMAP: one HTTPS session, push via EventSource, state strings for delta sync (`Email/changes`, `Mailbox/changes`), batched method calls, and server-side threading. **Build:** - **Auto-detect:** when a User connects a Fastmail account (by provider, or any account whose domain advertises JMAP via `/.well-known/jmap`), use JMAP automatically, with no setting to pick. Fall back to IMAP only if JMAP discovery fails. - **Auth:** Fastmail JMAP uses an API token (Settings → Privacy & Security → API tokens, scope Mail; read-only or read-write). The Connected Accounts form for Fastmail asks for that token instead of an app password, with a plain how-to link and wording. Store it like other credentials (encrypted, never logged). Same Connected Account row (#407). - **Sync engine:** a JMAP adapter behind the **same Mail cache/store** as IMAP (reuse: mailboxes → mail_folders, Email → mail_messages, threads, keywords → flags), so the UI, search and CalternalDAV mail proxy (#486) need no changes. - Initial sync: `Email/query` newest first in pages + `Email/get` with header/preview properties (bodies lazily). - Delta: `Email/changes` / `Mailbox/changes` from the stored state. - Push: EventSource with `types=Email,Mailbox`; reconnect with back-off. - Writes (flag/move/delete) go through `Email/set`, and sending (later) through `EmailSubmission/set`. - **Speed budget** (the owner wants Mail "crazy fast"): the first 100 newest Inbox messages visible ≤ 2 s after connecting; full header backfill streams in the background with progress; push latency ≤ 2 s. - **Tests:** an integration test against a JMAP test server (e.g. a local Stalwart or a recorded-fixture server), covering the initial page, delta, push, flag/move round-trip, and token revocation → a plain error. Real Fastmail verification by the owner (they provide the token in the UI; never in logs or issues). **Order:** after the IMAP first-sync bug (#613) is fixed. It reuses the Connected Accounts structure (#407).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#614
No description provided.