AgentSkillsCN

mail

通过JXA读取并管理Apple Mail邮件。当您需要处理电子邮件、归档邮件,或对收件箱中的邮件进行批量处理时,此工具将为您提供强大助力。

SKILL.md
--- frontmatter
name: mail
description: 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

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"