mneves75

Apple Mail Search

办公效率v1.0.0
作者:mneves75更新于 2026-05-11apple-mail-search@clawhub_mneves75/apple-mail-search
邮件处理#Sqlite

据 AlphaMoat 统计,截至 2026-09,Apple Mail Search 累计下载 4,879 次、获 2 个星标,在全部 5,078 个 AI 技能中排名第 1,916 位,在「办公效率」分类(435 个)中排名第 171 位。

累计安装
316
累计下载
4,879
星标
2
全站排名
#1,916
全站前 38% · 「办公效率」前 40%
平台累计安装累计下载星标评论
ClawHub ↗1474,60123
SkillHub ↗3164,8792—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

可搜索主题、发件人、收件人、日期、未读状态或附件名,可选 JSON 或 CSV 输出。需 sqlite3 和邮件索引访问权限。不读取正文,不撰写或发送邮件。使用窄范围查询,分享前审阅;导出可能在 Mail 外保存敏感元数据。

资料发布于 2026-10-27

可以用来做什么

  • 查找本地邮件元数据

什么时候用

  • Apple Mail 邮件需要限定范围的元数据查询时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

小范围查找匹配邮件元数据,只展示本任务需要的字段。

月度数据趋势

累计下载4,879
3,0444,0305,0152026-03 · 累计下载 3,1802026-05 · 累计下载 3,6852026-06 · 累计下载 3,8342026-07 · 累计下载 4,1632026-08 · 累计下载 4,4222026-09 · 累计下载 4,87926-0326-09
星标2
1232026-03 · 星标 22026-05 · 星标 22026-06 · 星标 22026-07 · 星标 22026-08 · 星标 22026-09 · 星标 226-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,879—2
2026-084,422+6.2%2
2026-074,163+8.6%2
2026-063,834+4.0%2
2026-053,685—2
2026-033,180—2

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

2.9 KB · ClawHub v1.0.0
---
name: apple-mail-search
description: Fast Apple Mail search via SQLite on macOS. Search emails by subject, sender, date, attachments - results in ~50ms vs 8+ minutes with AppleScript. Use when asked to find, search, or list emails.
homepage: https://github.com/steipete/clawdbot
metadata: {"clawdbot":{"emoji":"📬","os":["darwin"],"requires":{"bins":["sqlite3"]}}}
---

# Apple Mail Search

Search Apple Mail.app emails instantly via SQLite. ~50ms vs 8+ minutes with AppleScript.
展开全部(共 107 行)

## Installation

```bash
# Copy mail-search to your PATH
cp mail-search /usr/local/bin/
chmod +x /usr/local/bin/mail-search
```

## Usage

```bash
mail-search subject "invoice"           # Search subjects
mail-search sender "@amazon.com"        # Search by sender email
mail-search from-name "John"            # Search by sender name
mail-search to "[email protected]"  # Search sent mail
mail-search unread                      # List unread emails
mail-search attachments                 # List emails with attachments
mail-search attachment-type pdf         # Find PDFs
mail-search recent 7                    # Last 7 days
mail-search date-range 2025-01-01 2025-01-31
mail-search open 12345                  # Open email by ID
mail-search stats                       # Database statistics
```

## Options

```
-n, --limit N    Max results (default: 20)
-j, --json       Output as JSON
-c, --csv        Output as CSV
-q, --quiet      No headers
--db PATH        Override database path
```

## Examples

```bash
# Find bank statements from last month
mail-search subject "statement" -n 50

# Get unread emails as JSON for processing
mail-search unread --json | jq '.[] | .subject'

# Find all PDFs from a specific sender
mail-search sender "@bankofamerica.com" -n 100 | grep -i statement

# Export recent emails to CSV
mail-search recent 30 --csv > recent_emails.csv
```

## Why This Exists

| Method | Time for 130k emails |
|--------|---------------------|
| AppleScript iteration | 8+ minutes |
| Spotlight/mdfind | **Broken since Big Sur** |
| SQLite (this tool) | ~50ms |

Apple removed the emlx Spotlight importer in macOS Big Sur. This tool queries the `Envelope Index` SQLite database directly.

## Technical Details

**Database:** `~/Library/Mail/V{9,10,11}/MailData/Envelope Index`

**Key tables:**
- `messages` - Email metadata (dates, flags, FKs)
- `subjects` - Subject lines
- `addresses` - Email addresses and display names
- `recipients` - TO/CC mappings
- `attachments` - Attachment filenames

**Limitations:**
- Read-only (cannot compose/send)
- Metadata only (bodies in .emlx files)
- Mail.app only (not Outlook, etc.)

## Advanced: Raw SQL

For custom queries, use sqlite3 directly:

```bash
sqlite3 -header -column ~/Library/Mail/V10/MailData/Envelope\ Index "
SELECT m.ROWID, s.subject, a.address
FROM messages m
JOIN subjects s ON m.subject = s.ROWID
LEFT JOIN addresses a ON m.sender = a.ROWID
WHERE s.subject LIKE '%your query%'
ORDER BY m.date_sent DESC
LIMIT 20;
"
```

## License

MIT

「办公效率」分类下的热门技能

mneves75 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。