- Home
- Download
- Contribute
- Support
- Cyrus SASL

# JMAP support

JMAP is an alternate mechanism for synchronising a mail client with a mail server, intended as a replacement for IMAP. It is a transport-agnostic, stateless JSON-based API, aiming to be compatible with the IMAP data model, but with reduced data usage and more efficient synchronisation.

Warning

Cyrus versions 3.0 to 3.0.5 included experimental JMAP support, based on a snapshot of the then current JMAP specification draft. However, since the code-freeze of the Cyrus IMAPd 3.0 release, the JMAP specification at the IETF JMAP working group <https://datatracker.ietf.org/wg/jmap/about/> has evolved rapidly. Backporting the latest JMAP specification to Cyrus version 3.0 was unfeasible. Version 3.0.6 removed the outdated JMAP implementation draft from the 3.0 stable branch. Future Cyrus stable releases will implement JMAP once the specification is standardized.

Installations currently using JMAP are highly encouraged to upgrade to the latest Cyrus IMAPd development snapshot which implements the latest specification draft.

The remainder of this section is only relevant for versions 3.0 to 3.0.5.

## Cyrus administration

### Compile JMAP support into Cyrus

1. Enable JMAP (and DAV) in Cyrus:

   > - `./configure --enable-http --enable-jmap` along with your other configuration options.

2. Enable conversation support

   > - In imapd.conf(5), set `conversations: 1`, `conversations_db: twoskip`
   > - Create a conversations.db for each user: `ctl_conversationsdb -b -r`

3. JMAP depends on Xapian. For full support (to gain full word boundary distinctions in CJK languages - Chinese, Japanese and Korean), this needs to be manually compiled due to extra patches needing to be applied. Our Xapian install guide shows how.

4. Once installed, the `jmap` module must be enabled in imapd.conf(5): `httpmodules: jmap`

## JMAP client

### Test JMAP support

Once Cyrus is running, you can test JMAP on the command line for any existing Cyrus user. The user must at least have an INBOX provisioned but is not required to have any calendars, contacts or messages.

To obtain the JMAP calendars for user `test`, issue the following request:

    curl -X POST \
         -H "Content-Type: application/json" \
         -H "Accept: application/json" \
         --user test:test \
         -d '[["getCalendars", {}, "#1"]]' \
         http://localhost/jmap

you should get a response which looks similar to

    [
        [
            "calendars",
            {
                "accountId": "test@localhost",
                "list": [
                    {
                        "color": "#FD8208FF",
                        "id": "Default",
                        "mayAddItems": true,
                        "mayDelete": true,
                        "mayModifyItems": true,
                        "mayReadFreeBusy": true,
                        "mayReadItems": true,
                        "mayRemoveItems": true,
                        "mayRename": true,
                        "name": "Default",
                        "sortOrder": 1,
                        "x-href": "/dav/calendars/user/test@localhost/Default"
                    }
                ],
                "notFound": null,
                "state": "184"
            },
            "#1"
        ]
    ]

Similar requests exist to obtain contacts and messages. For details, see the JMAP specification.

### Optional: Install sample JMAP client

Note

Cyrus does not yet implement JMAP authentication. Instead, it requires for each request the HTTP Basic Auth header set with the account’s username and password. If you intend to use the JMAP perl or web clients, make sure to add the required authentication headers for each request.

You can set up the JMAP Proxy (perl) to sit in front of a standard IMAP server and query that over a custom JMAP client.

Or you can install a sample JMAP web client which requires the Overture.js library and JMAP JS library to talk to a JMAP-enabled Cyrus server and build from there (subject to the MIT license.

The web client is a simple example (no compose, contacts or calendars). When you create your account, the most recent 50 emails will be downloaded in their entirety, so the first page should be snappy immediately. After that, you are redirected to the landing page. A background task will continue to pull in batches of messages and add them to your account, so you will see older messages appear while you are using the interface.

### Developing the client further

You’ll want to become deeply familiar with the JMAP developer documentation