Skip to content
Agentmart
Submit a tool

imap-mail

Read, search, triage, and move email in any IMAP mailbox — Gmail, iCloud, Proton Bridge, Fastmail, self-hosted, anything speaking IMAP.

Skill by HaraldeRoessler

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/haralderoessler-imap-mail

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Read, search, triage, and move email in any IMAP mailbox — Gmail, iCloud, Proton Bridge, Fastmail, self-hosted, anything speaking IMAP. Use when the user asks to check their inbox, search emails, summarize messages, flag, delete, or move email. Triggers on mentions of check mail, inbox, unread, search email, archive, move to folder. Requires IMAP_HOST, IMAP_USER, IMAP_PASSWORD (and optionally IMAP_PORT) env vars on the agent.

Use cases: productivity, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/imap-mail

What's inside

Skill name
imap-mail
Description
Read, search, triage, and move email in any IMAP mailbox — Gmail, iCloud, Proton Bridge, Fastmail, self-hosted, anything speaking IMAP. Use when the user asks to check their inbox, search emails, summarize messages, flag, delete, or move email. Triggers on mentions of check mail, inbox, unread, search email, archive, move to folder. Requires IMAP_HOST, IMAP_USER, IMAP_PASSWORD (and optionally IMAP_PORT) env vars on the agent.
License
MIT
Compatibility
Requires python3 stdlib only (imaplib, email). Works on Linux.
Instructions
216 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (1)

  • SKILL.md

SKILL.md (first lines)

# IMAP Mail Skill

Read and manipulate email via IMAP using Python stdlib only — no external packages. Any IMAP server works; examples below assume TLS on port 993.

## Prerequisites

Four environment variables (configure from the portal Settings → Skills → IMAP Mail):

- `IMAP_HOST` — e.g. `imap.gmail.com`, `imap.mail.me.com`, `127.0.0.1` (Proton Bridge), `imap.fastmail.com`
- `IMAP_USER` — full email address
- `IMAP_PASSWORD` — an app-specific password, NOT the main account password
  - Gmail: https://myaccount.google.com/apppasswords (requires 2FA enabled)
  - iCloud: https://appleid.apple.com → App-Specific Passwords
  - Proton: Proton Bridge generates a local password
  - Fastmail: Settings → Privacy & Security → App Passwords
- `IMAP_PORT` — optional, defaults to 993 (TLS)

## List recent messages

```bash
python3 - <<'PY'
import os, imaplib, email
from email.header import decode_header

M = imaplib.IMAP4_SSL(os.environ["IMAP_HOST"], int(os.environ.get("IMAP_PORT", 993)))
M.login(os.environ["IMAP_USER"], os.environ["IMAP_PASSWORD"])
M.select("INBOX", readonly=True)

typ, data = M.search(None, "ALL")
ids = data[0].split()[-20:]  # last 20 messages

for mid in reversed(ids):
    typ, d = M.fetch(mid, "(BODY.PEEK[HEADER.FIELDS (FROM SUBJECT DATE)])")
    hdr = email.message_from_bytes(d[0][1])
    def dec(v):
        parts = decode_header(v or "")
        return "".join(p.decode(c or "utf-8", "replace") if isinstance(p, bytes) else p for p, c in parts)
    print(f"[{mid.decode()}] {dec(hdr['Date']):25} | {dec(hdr['From']):40} | {dec(hdr['Subject'])}")

M.logout()
PY
```

Use `readonly=True` on SELECT whenever you are not modifying state — it prevents \Seen flag changes.

## List unread only

```bash
python3 - <<'PY'
import os, imaplib, email
from email.header import decode_header

M = imaplib.IMAP4_SSL(os.environ["IMAP_HOST"], int(os.environ.get("IMAP_PORT", 993)))
M.login(os.environ["IMAP_USER"], os.environ["IMAP_PASSWORD"])
M.select("INBOX", readonly=True)
typ, data = M.search(None, "UNSEEN")
unread_ids = data[0].split()
print(f"{len(unread_ids)} unread")

for mid in unread_ids[-30:]:
    typ, d = M.fetch(mid, "(BODY.PEEK[HEADER.FIELDS (FROM SUBJECT DATE)])")
    hdr = email.message_from_bytes(d[0][1])
    def dec(v):
        parts = decode_header(v or "")
        return "".join(p.decode(c or "utf-8", "replace") if isinstance(p, bytes) else p for p, c in parts)
    print(f"[{mid.decode()}] {dec(hdr['From']):40} | {dec(hdr['Subject'])}")

M.logout()
PY
```

## Search

IMAP search syntax — no quotes around field tokens, quoted strings only for values containing spaces:

```bash
python3 - <<'PY'
import os, imaplib
M = imaplib.IMAP4_SSL(os.environ["IMAP_HOST"], int(os.environ.get("IMAP_PORT", 993)))
M.login(os.environ["IMAP_USER"], os.environ["IMAP_PASSWORD"])
M.select("INBOX", readonly=True)

# Examples — replace criteria as needed:
# - FROM "alice@example.com"
# - SUBJECT "invoice"
# - SINCE 01-Jan-2025
# - UNSEEN
# - TEXT "refund"
# - LARGER 5000000  (bytes)

typ, data = M.search(None, 'FROM "notifications@github.com"', 'SINCE', '01-Jan-2026')
ids = data[0].split()
print(f"{len(ids)} matches")
print([i.decode() for i in ids[-20:]])
M.logout()
PY
```

Combine criteria by passing them as separate positional args (implicit AND). For OR, prefix with `OR`:
```python
M.search(None, 'OR', 'FROM', '"alice@example.com"', 'FROM', '"bob@example.com"')
```

## Read a message (full body, including HTML + attachments list)

```bash
python3 - <<'PY'
import os, imaplib, email, sys
from email.header import decode_header

MSG_ID = sys.argv[1] if len(sys.argv) > 1 else "1"

M = imaplib.IMAP4_SSL(os.environ["IMAP_HOST"], int(os.environ.get("IMAP_PORT", 993)))
M.login(os.environ["IMAP_USER"], os.environ["IMAP_PASSWORD"])
M.select("INBOX", readonly=True)
typ, data = M.fetch(MSG_ID.encode(), "(RFC822)")
msg = email.message_from_bytes(data[0][1])

def dec(v):

From HaraldeRoessler/ownify-microclaw, MIT.

More from HaraldeRoessler/ownify-microclaw

Signals

Stars
0
Forks
0
Open issues
1
Last commit (this folder)
Apr 24, 2026 (6 months ago)
Last release
Jun 7, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from HaraldeRoessler

Cite this page

imap-mail skill. Agent Mart. https://agentmart.dev/skills/haralderoessler-imap-mail (last updated 2026-10-24)