AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Email Imap Full Fetch

skill-tiangong-ai-agent-skills-email-imap-full-fetch · by tiangong-ai

Fetch full email MIME content and attachment files from IMAP by message reference. Use when downstream steps already have a stage-1 mail_ref and need full headers/body/attachments for a specific message, with message_id_norm as the primary lookup key and uid only as fallback.

— No reviews yet
0 installs
0 views
— view→install

Install

$ agentstack add skill-tiangong-ai-agent-skills-email-imap-full-fetch

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • ✓ Prompt-injection patterns
  • ✓ Secret / credential exfiltration
  • ✓ Dangerous shell & filesystem operations
  • ✓ Untrusted network calls
  • ✓ Known-malicious package signatures

What it can access

  • ✓ Network access No
  • ✓ Filesystem access No
  • ✓ Shell / process execution No
  • ✓ Environment & secrets No
  • ✓ Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-tiangong-ai-agent-skills-email-imap-full-fetch)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
● 12d ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Email Imap Full Fetch? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Email IMAP Full Fetch

Core Goal

  • Fetch one target email by stable message reference from IMAP.
  • Enforce lookup order: HEADER Message-Id exact match first, then uid fallback.
  • Download full raw MIME via BODY.PEEK[].
  • Parse and return headers, full text body, html body, and attachment metadata.
  • Save .eml and attachment files to disk with filename safety and idempotent indexing.

Standard Flow

  1. Input must include message_id_norm from stage-1 routing output (mail_ref.message_id_norm).
  2. Use fetch --message-id "" as the default path.
  3. Use fetch --uid "" only when no usable message-id is available.
  4. Keep mailbox selection consistent with stage-1 (--mailbox or IMAP_MAILBOX).
  5. Read JSON output and continue downstream processing with returned mail_ref.

Commands

Fetch by Message-Id (preferred):

python3 scripts/imap_full_fetch.py fetch --message-id ""

Fetch by UID (fallback only):

python3 scripts/imap_full_fetch.py fetch --uid "123456"

Use both when needed (message-id lookup first, uid fallback second):

python3 scripts/imap_full_fetch.py fetch --message-id "" --uid "123456"

Output Contract

  • Output is a single JSON object.
  • Required top-level fields:
  • mail_ref
  • headers
  • text_plain
  • text_html
  • attachments
  • saved_eml_path
  • mail_ref contains:
  • account, mailbox, uid, message_id_raw, message_id_norm, date
  • attachments[] contains per-file metadata and persistence result:
  • filename, content_type, bytes, disposition, saved_path, skipped_reason

Storage And Idempotency

  • saved_eml_path points to local .eml file saved from BODY.PEEK[].
  • Attachments are saved without returning attachment binary content in JSON.
  • Filenames are sanitized to remove path separators and unsafe characters.
  • Duplicate attachment names are deduped with content-hash suffix.
  • Repeated requests are idempotent by message_id_norm index and return existing persisted JSON record directly.

Parameters

  • --message-id: primary lookup key.
  • --uid: fallback lookup key.
  • --mailbox: mailbox to query (default IMAP_MAILBOX or INBOX).
  • --save-eml-dir: target dir for .eml files (env IMAP_FULL_SAVE_EML_DIR).
  • --index-dir: target dir for idempotency index JSON files (env IMAP_FULL_INDEX_DIR, default /.index).
  • --save-attachments-dir: target dir for attachments (env IMAP_FULL_SAVE_ATTACHMENTS_DIR).
  • --max-attachment-bytes: max saved attachment size (env IMAP_FULL_MAX_ATTACHMENT_BYTES).
  • --allow-ext: allowed attachment extensions, comma-separated (env IMAP_FULL_ALLOW_EXT).
  • --connect-timeout: IMAP connect timeout seconds (default from IMAP_CONNECT_TIMEOUT).

Required Environment

  • IMAP_HOST
  • IMAP_USERNAME
  • IMAP_PASSWORD

Optional account defaults:

  • IMAP_NAME
  • IMAP_PORT
  • IMAP_SSL
  • IMAP_MAILBOX

Scripts

  • scripts/imap_full_fetch.py

Source & license

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

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

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.