apple-mail
Original:🇺🇸 English
Translated
1 scripts
Search, read, and extract attachments from Apple Mail's local storage. Query emails by sender, recipient, subject, body, date, mailbox, and flags. Read raw RFC822 messages and extract file attachments.
11installs
Sourcemitsuhiko/agent-stuff
Added on
NPX Install
npx skill4agent add mitsuhiko/agent-stuff apple-mailTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Apple Mail Skill
Search, read, and extract attachments from Apple Mail's local storage on macOS.
Tool
apple-mail.sh.emlxQuick Reference
bash
TOOL=~/Development/agent-stuff/skills/apple-mail/apple-mail.sh
# Search emails
$TOOL search --from "peter@" --subject "dinner" --limit 5
$TOOL search --after 2026-02-01 --has-attachment
$TOOL search --body "invoice" --mailbox "INBOX" --unread
$TOOL search --to "armin@" --before 2025-12-31
# Show message metadata, recipients, attachments, and summary
$TOOL info 783660
# Read the raw RFC822 email (headers + body)
$TOOL read 783660
# Extract attachments to a temp directory (prints the path)
$TOOL attachment 783660 # all attachments
$TOOL attachment 783660 "Rechnung.pdf" # specific file
# List all mailboxes with counts
$TOOL mailboxesSearch Options
| Flag | Description |
|---|---|
| Sender address substring |
| Recipient address substring |
| Subject substring |
| Body/summary text substring |
| Mailbox URL substring (e.g. |
| Received after date |
| Received before date |
| Only unread messages |
| Only flagged messages |
| Only messages with attachments |
| Max results (default: 20) |
Output Format
- returns pipe-delimited table with header row:
searchid|sender|sender_name|subject|received|status|flagged|mailbox|attachments - returns structured metadata sections
info - outputs raw RFC822 email to stdout
read - prints the temp directory path to stdout, file listing to stderr
attachment
Notes
- Message IDs are Apple Mail internal ROWIDs (integers), shown in the column
id - files contain headers only (body not downloaded);
.partial.emlxwarns about thisread - Attachments are copied to a temp directory under ; clean up when done
/tmp/ - The search queries the
bodytable (Apple Mail's plaintext preview), not the full email bodysummaries - Mailbox URLs are percent-encoded (e.g., =
%5BGmail%5D,[Gmail]= space)%20 - Deleted messages are excluded from search by default