# JMAP OCaml Client An OCaml interface to the JMAP protocol ([RFC8620](https://datatracker.ietf.org/doc/html/rfc8620)) and JMAP Mail extension ([RFC8621](https://datatracker.ietf.org/doc/html/rfc8621)). **Note:** This library is largely AI-generated and has not been audited carefully. It's a proof-of-concept implementation of the JMAP specification. ## Overview JMAP (JSON Meta Application Protocol) is a modern protocol for synchronizing email, calendars, and contacts designed as a replacement for legacy protocols like IMAP. This OCaml implementation provides: - Type-safe OCaml interfaces to the JMAP Core and Mail specifications - Authentication with username/password or API tokens (Fastmail support) - Convenient functions for common email and mailbox operations - Support for composing complex multi-part requests with result references - Typed handling of message flags, keywords, and mailbox attributes ## Installation Add to your project with opam: ``` opam install . ``` ## Features - **Core JMAP Protocol** - Session handling - API request/response management - Type-safe representation of all JMAP structures - Result references for composing multi-step requests - **JMAP Mail Extension** - Mailbox operations (folders/labels) - Email retrieval and manipulation - Thread handling - Identity management - Email submission - Message flags and keywords - **Fastmail Integration** - API token authentication - Example tools for listing messages ## Documentation The library includes comprehensive OCamldoc documentation with cross-references to the relevant sections of the JMAP specifications. Build the documentation with: ``` dune build @doc ``` ## Example Tools The package includes several example tools: - `fastmail-list`: Lists emails from a Fastmail account (requires JMAP_API_TOKEN) - `jmap-tutorial-examples`: Demonstrates basic JMAP operations as shown in the tutorial ## License [MIT License](LICENSE) ## References - [RFC8620: The JSON Meta Application Protocol (JMAP)](https://datatracker.ietf.org/doc/html/rfc8620) - [RFC8621: The JSON Meta Application Protocol (JMAP) for Mail](https://datatracker.ietf.org/doc/html/rfc8621) - [Message Flag and Mailbox Attribute Extension](https://datatracker.ietf.org/doc/html/draft-ietf-mailmaint-messageflag-mailboxattribute-02) - [Fastmail Developer Documentation](https://www.fastmail.com/dev/)