Skip to content

Read-only JMAP Support #12610

@ChristophWurst

Description

@ChristophWurst

Summary

Implement read-only JMAP support: connect to JMAP servers, sync mailbox structure, and fetch messages.

Problem

Users with JMAP-enabled accounts cannot access their mail via Nextcloud Mail.
We need to add JMAP as a supported protocol with feature parity to IMAP for reading mail.

Solution

  • Create JMAP client factory using SebastianKrupinski/jmap-client-php
  • Implement mailbox structure sync and conversion to domain models
  • Implement message fetching and conversion to domain models
  • Handle JMAP Session endpoint discovery and state-based sync
  • Ensure output uses same domain models as IMAP

Implementation

Create lib/JMAP/ namespace for JMAP-specific logic:

  • JmapClientFactory - creates and configures JMAP client
  • JmapMailboxMapper - converts JMAP Mailbox objects to domain models
  • JmapMailboxSync - syncs folder structure into database
  • JmapMessageMapper - converts JMAP Message objects to MessageDTO
  • JmapSync - orchestrates message sync using JMAP state tokens

Credential handling reuses existing encryption patterns.

Session discovery fetches .well-known/jmap for JMAP capabilities.

Sync strategy:

  • Full sync on first run
  • Incremental sync using JMAP state tokens on subsequent runs
  • Detects new/changed/deleted messages

Message extraction:

  • Headers (To, From, Subject, Date, Message-ID, References, In-Reply-To)
  • Flags and keywords
  • Attachment metadata
  • Message IDs for threading

Affected Components

Acceptance Criteria

  • JMAP accounts can be created (via JMAP Protocol Abstraction and Routing Infrastructure #12609 infrastructure)
  • Connection test validates JMAP server availability
  • Mailbox structure syncs correctly
  • Messages fetch with all required properties
  • Output matches IMAP mapper format (same domain models)
  • Existing IMAP sync unaffected

Out of Scope

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions