Enables JMAP email operations using Node.js and jmap-jam library...
Access JMAP email servers (FastMail, Cyrus IMAP, Stalwart) using pre-built scripts.
Environment variables must be set before launching Claude Code:
JMAP_SESSION_URL - JMAP server session URLJMAP_BEARER_TOKEN - Authentication bearer tokenJMAP_ACCOUNT_ID - Account ID (optional, auto-detected)Choose the right script:
list-emails.ts (supports --unread, --flagged, --mailbox, --from, --limit filters)list-emails.ts --from "sender@example.com"search-keywords.ts keyword1 keyword2 ...get-email.ts with email IDlist-mailboxes.tsmove-by-ids.ts --mailbox <name> <id1> <id2> ...delete-emails.ts <id1> <id2> ...All scripts support --help for detailed usage.
node scripts/list-emails.ts --unread
node scripts/list-emails.ts --unread --limit 50
node scripts/list-emails.ts --from "sender@example.com"
node scripts/list-emails.ts --from "sender@example.com" --unread
node scripts/search-keywords.ts "invoice" "receipt" "order confirmation"
node scripts/search-keywords.ts --mailbox "Archive" --limit 10 "meeting" "agenda"
Note: Search shows previews only. For full email content, use get-email.ts with the email ID.
node scripts/get-email.ts <email-id>
search-keywords.ts "keyword1" "keyword2"get-email.ts <email-id>move-by-ids.ts --mailbox @MailboxName id1 id2 id3Workflow for processing new emails with learning:
Fetch recent emails:
list-emails.ts --limit 20 to get batch (optionally add --unread or --mailbox "Inbox")Present classification options:
Execute moves:
move-by-ids.ts --mailbox <name> <id1> <id2> ... for each groupSave routing patterns to memory:
Benefits:
node scripts/list-mailboxes.ts
Scripts output compact, human-readable results:
Found 5 email(s) (unread)
================================================================================
ā [UNREAD] Meeting tomorrow
From: John Doe <john@example.com>
Date: 1/15/2024, 10:30:45 AM
ID: StrgucNsyw-3
Preview: Hi Jane, let's meet at 2pm to discuss the project...
--------------------------------------------------------------------------------
For writing custom JMAP operations or understanding the API, see: