Apple Mail Automation

•
7
•

Automates Apple Mail management tasks using JavaScript for Automation (JXA) to read, process, and archive messages.

The Apple Mail skill empowers Claude to interact directly with the native macOS Mail application via JXA (JavaScript for Automation). It provides a structured way to read inbox messages, extract key metadata like senders and subjects, and implement sophisticated archiving workflows that navigate account-specific mailbox structures. This is particularly useful for developers looking to automate their inbox management or build custom workflows that bridge email communication with their development environment.

Key Features

01Smart archiving logic that identifies account-specific archive mailboxes
027 GitHub stars
03Native JXA integration for seamless macOS automation
04Batch processing patterns for efficient email management
05Optimized handling of JXA-specific array and selector limitations
06Programmatic access to Apple Mail inbox and message properties

Use Cases

01Creating custom filters and notification scripts via Claude
02Automating Inbox Zero by batch-archiving processed messages
03Programmatically extracting data from incoming emails for dev tasks
name description
mail
Reading and managing Apple Mail via JXA. Use when working with email, archiving messages, or processing the inbox.

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"