Skip to main content
Generalbendrucker

mail

Reading and managing Apple Mail via JXA. Use when working with email, archiving messages, or processing the inbox.

Stars
13
Source
bendrucker/claude
Updated
2026-05-31
Slug
bendrucker--claude--mail
View on GitHubRaw SKILL.md

// install — copy + paste into any project

mkdir -p .claude/skills && curl -fsSL https://raw.githubusercontent.com/bendrucker/claude/HEAD/plugins/mail/skills/mail/SKILL.md -o .claude/skills/mail.md

Drops the SKILL.md into .claude/skills/mail.md. Works with Claude Code, Cursor, and any agent that loads SKILL.md files from .claude/skills/.

Mail

Apple Mail automation via JXA (osascript -l JavaScript).

Archiving

Mail.app delete() moves messages to Trash, not Archive. There is no archiveMailbox property — find the archive mailbox by name per account.

See archiving.md for account detection, mailbox lookup, and batch archive patterns.

Reading

var app = Application("Mail");
var inbox = app.inbox();
var messages = inbox.messages();

Key properties: subject(), sender(), dateReceived(), content(), mailbox().account().

Notes

  • JXA arrays from Mail may lack .map()/.filter() — use Array.from() or for-loops
  • .whose() selectors fail on child mailbox arrays — use for-loops
  • Launch Mail first if not running: open -g -a "Mail"