AtlatestRenderedmarkdown
Readme

sigil-jmap

A Sigil library for JMAP email (RFC 8620/8621). Works with Fastmail, Stalwart, Cyrus, Apache James, and other JMAP-compatible servers.

Features

  • Session discovery -- Bearer token or Basic auth, automatic capability detection
  • Mailbox operations -- list, find by role/name, create, update, delete
  • Email querying -- filter by mailbox, sort, paginate with back-referenced query+get
  • Email retrieval -- single or batch with full body content
  • Email mutations -- move between mailboxes, set/remove keywords, delete
  • Email sending -- with identity selection, to/cc/bcc, text and HTML bodies
  • Blob download -- fetch attachments via template URL expansion
  • Error handling -- JMAP-level error type checking

Usage

Add sigil-jmap as a dependency in your package.sgl:

(from-git url: "codeberg:sigil/sigil-jmap" package: "sigil-jmap")

Then connect and query email:

(import (sigil jmap))

(define session (jmap-connect
                  url: "https://api.fastmail.com/jmap/session"
                  token: (getenv "JMAP_TOKEN")))

;; List mailboxes
(define mailboxes (jmap-mailboxes session))

;; Find inbox
(define inbox (jmap-mailbox-by-role session "inbox"))

;; Query recent emails
(define emails (jmap-email-query session
                 mailbox-id: (jmap-mailbox-id inbox)
                 limit: 10))

Modules

ModuleDescription
(sigil jmap)Top-level re-exports
(sigil jmap client)Session discovery, JMAP request/response handling
(sigil jmap mailbox)Mailbox CRUD operations
(sigil jmap email)Email query, get, update, move, delete
(sigil jmap send)Identity listing and email submission

Dependencies

  • sigil-stdlib
  • sigil-json
  • sigil-http

Building

sigil deps install
sigil build
sigil test

License

BSD-3-Clause