JMAP Courier
A TypeScript JMAP client for email that works with any JMAP-compliant provider.
Implements RFC 8620 (JMAP Core) and RFC 8621 (JMAP Mail).
Installation
npm install jmap-courierQuick Start
import { JMAPClient } from 'jmap-courier';
const client = new JMAPClient({
name: 'my-account',
token: 'your-api-token',
sessionUrl: 'https://api.fastmail.com/jmap/session', // Provider-specific
});
// Fetch session and list mailboxes
await client.fetchSession();
const mailboxes = await client.getMailboxes();
// Search emails
const emailIds = await client.queryEmails({ inMailbox: 'inbox-id' });
const emails = await client.getEmails(emailIds);
// Send an email
await client.sendEmail({
to: ['recipient@example.com'],
subject: 'Hello',
textBody: 'Hello from JMAP Courier!',
});Provider Session URLs
| Provider | Session URL |
|---|---|
| Fastmail | https://api.fastmail.com/jmap/session |
| Cyrus | https://your-server/.well-known/jmap |
| Stalwart | https://your-server/.well-known/jmap |
API Reference
JMAPClient
fetchSession()- Initialize connection and get account infogetMailboxes()- List all mailboxesgetMailboxByRole(role)- Find mailbox by role (inbox, trash, sent, etc.)queryEmails(filter?, sort?, limit?)- Search for emailsgetEmails(ids, properties?)- Get emails by IDgetEmailWithBody(id)- Get full email with body contentmoveEmails(ids, mailboxId)- Move emails to mailboxdeleteEmails(ids)- Move emails to trashmarkEmailsRead(ids, isRead)- Mark as read/unreadmarkEmailsFlagged(ids, isFlagged)- Flag/unflag emailssendEmail(params)- Send a new emailforwardEmail(params)- Forward an email
Credits
Copyright © 2026 Anand Mandapati
Created with AI using Antigravity and Claude Opus.
License
MIT - see LICENSE for details.
On this page
Contributors
MIT License
Created January 27, 2026
Updated January 27, 2026