# Mail From

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-aashari-ai-agent-skills-mail-from`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [aashari](https://agentstack.voostack.com/s/aashari)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [aashari](https://github.com/aashari)
- **Source:** https://github.com/aashari/ai-agent-skills/tree/main/skills/apple-mail/mail-from

## Install

```sh
agentstack add skill-aashari-ai-agent-skills-mail-from
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Mail From — All Emails From a Sender

Sender query: **$ARGUMENTS**

## Steps

### 1. Find matching senders
```bash
DB="$HOME/Library/Mail/V10/MailData/Envelope Index"
QUERY="$ARGUMENTS"  # treat as search term against address + comment fields

sqlite3 "$DB" "
SELECT DISTINCT a.address, a.comment, COUNT(*) as cnt
FROM messages m
JOIN addresses a ON m.sender = a.ROWID
JOIN mailboxes mb ON m.mailbox = mb.ROWID
WHERE (a.address LIKE '%${QUERY}%' OR a.comment LIKE '%${QUERY}%')
  AND m.deleted = 0
GROUP BY a.address
ORDER BY cnt DESC
LIMIT 10;" 2>/dev/null
```

If multiple matches, show options and ask which one (or proceed with all if they're clearly the same person/org).

### 2. Get all emails from the matched address(es)
```bash
sqlite3 "$DB" "
SELECT datetime(m.date_received,'unixepoch','localtime') as dt,
       s.subject, mb.url as mailbox, m.ROWID, m.read, m.flagged
FROM messages m
JOIN subjects  s  ON m.subject = s.ROWID
JOIN addresses a  ON m.sender  = a.ROWID
JOIN mailboxes mb ON m.mailbox = mb.ROWID
WHERE a.address LIKE '%SENDER%'
  AND m.deleted = 0
  AND mb.url NOT LIKE '%Spam%'
  AND mb.url NOT LIKE '%Trash%'
ORDER BY m.date_received DESC
LIMIT 100;" 2>/dev/null
```

### 3. Compute relationship stats
```bash
sqlite3 "$DB" "
SELECT
  COUNT(*) as total,
  SUM(CASE WHEN m.read = 0 THEN 1 ELSE 0 END) as unread,
  SUM(CASE WHEN m.flagged = 1 THEN 1 ELSE 0 END) as flagged,
  MIN(datetime(m.date_received,'unixepoch','localtime')) as first_email,
  MAX(datetime(m.date_received,'unixepoch','localtime')) as latest_email,
  strftime('%Y-%m', datetime(m.date_received,'unixepoch','localtime')) as busiest_month
FROM messages m
JOIN addresses a ON m.sender = a.ROWID
JOIN mailboxes mb ON m.mailbox = mb.ROWID
WHERE a.address LIKE '%SENDER%' AND m.deleted = 0
GROUP BY busiest_month
ORDER BY COUNT(*) DESC LIMIT 1;" 2>/dev/null
```

### 4. Read recent emails if user wants details
```bash
python3 ~/.claude/skills/_mail-shared/parser.py   ...
```

## Output Format
Lead with relationship summary:
- **X emails** from [name/address], spanning [date range]
- First contact: [date] — Latest: [date]
- Unread: X | Flagged: X

Then list recent emails (last 10-20) as a table.
Group older emails by month if there are many.
Highlight unread and flagged ones.
Offer to read any specific email or summarize the thread.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [aashari](https://github.com/aashari)
- **Source:** [aashari/ai-agent-skills](https://github.com/aashari/ai-agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-aashari-ai-agent-skills-mail-from
- Seller: https://agentstack.voostack.com/s/aashari
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
