# Mail

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

- Skill: `tomevault-io/mail` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/mail`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/mail/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/mail

---


# 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](archiving.md) for account detection, mailbox lookup, and batch archive patterns.

## Reading

```javascript
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"`

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/bendrucker) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

