email-imap-fetch

tiangong-ai/skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/tiangong-ai/skills --skill email-imap-fetch
0 commentsdiscussion
summary

Environment defaults:

skill.md

Email IMAP Fetch

Core Goal

  • Wait for new mail with IMAP IDLE.
  • Fetch unread messages after each wake-up.
  • Support multiple mailbox accounts configured with env.
  • Control IDLE support strictly with env mode (idle or poll) without runtime probing.
  • Forward each fetched email to OpenClaw webhooks.
  • Emit machine-readable JSON lines for downstream steps.
  • Keep this skill strictly in stage-1 routing mode: send snippet + structured refs only, never send full raw message body, and never send attachment binary/content.

Workflow

  1. Configure account env variables and OpenClaw webhook env variables (see references/env.md and assets/config.example.env).
  2. Validate configuration:
python3 scripts/imap_idle_fetch.py check-config
  1. Run one IDLE cycle per account (smoke test):
python3 scripts/imap_idle_fetch.py listen --cycles 1 --idle-seconds 120 --max-messages 10
  1. Run continuously (default resident mode):
python3 scripts/imap_idle_fetch.py listen

Runtime Model

  • Skill files are installed locally, but the listener is not auto-started.
  • In idle mode, IMAP IDLE receives push events only while listener process and IMAP connection are alive.
  • In poll mode, listener sleeps for poll interval and then fetches unread messages.
  • If the process exits, push events are missed; next run can still fetch existing unread emails with UNSEEN.
  • Default runtime is resident mode (IMAP_CYCLES=0 by default).
  • Default IDLE mode is poll (safe for servers without IDLE support).
  • In production, always-on deployment must run under systemd, launchd, supervisor, or an equivalent daemon manager.
  • Do not run the listener as a foreground process bound to an interactive exec session; once that session exits, the listener will stop.

Output Contract

  • Output format is JSONL (one JSON object per line).
  • type=status for lifecycle events.
  • type=message for fetched emails with:
    • account, mailbox, seq, uid
    • subject, from, to, date
    • message_id_raw, message_id_norm (and compatibility field message_id)
    • snippet (plain-text preview only)
    • attachment_count, attachment_manifest (summary only, no attachment content)
    • mail_ref machine-readable object (account, mailbox, uid, message_id_raw, message_id_norm, date)
  • Webhook message includes two fixed machine-readable blocks for deterministic dispatch extraction:
    • <<<MAIL_REF_JSON>>> ... <<<END_MAIL_REF_JSON>>>
    • <<<ATTACHMENT_MANIFEST_JSON>>> ... <<<END_ATTACHMENT_MANIFEST_JSON>>>
  • wait_mode is idle or poll in cycle status output.
  • wait_events records the active wait strategy details.
  • event=webhook_delivered status events when OpenClaw webhook POST succeeds.
  • type=error for account-level failures.
  • event=webhook_failed error events when OpenClaw webhook POST fails.

Parameters

  • --cycles: IDLE cycles per account (0 means forever).
  • --idle-seconds: max wait time for each IDLE call.
  • --poll-seconds: interval used when polling mode is active.
  • --idle-mode: idle or poll.
  • --max-messages: max unread emails fetched each cycle.
  • --mark-seen / --no-mark-seen: control unread state updates.
  • --snippet-chars: preview length limit.
  • --connect-timeout: connection timeout seconds.
  • --retry-seconds: retry delay after failure.

Environment defaults:

  • IMAP_CYCLES
  • IMAP_IDLE_MODE
  • IMAP_IDLE_SECONDS
  • IMAP_POLL_SECONDS
  • IMAP_MAX_MESSAGES
  • IMAP_MARK_SEEN
  • IMAP_SNIPPET_CHARS
  • IMAP_CONNECT_TIMEOUT
  • IMAP_RETRY_SECONDS

OpenClaw webhooks forwarding:

  • OPENCLAW_WEBHOOKS_ENABLED
  • OPENCLAW_WEBHOOKS_TOKEN
  • OPENCLAW_WEBHOOKS_BASE_URL
  • OPENCLAW_WEBHOOKS_MODE (agent or wake)
  • OPENCLAW_WEBHOOKS_ENDPOINT (optional endpoint override)
  • OPENCLAW_WEBHOOKS_PATH
  • OPENCLAW_WEBHOOKS_WAKE_MODE
  • OPENCLAW_WEBHOOKS_DELIVER
  • OPENCLAW_WEBHOOKS_TIMEOUT
  • OPENCLAW_WEBHOOKS_NAME
  • OPENCLAW_WEBHOOKS_AGENT_ID
  • OPENCLAW_WEBHOOKS_CHANNEL
  • OPENCLAW_WEBHOOKS_TO
  • OPENCLAW_WEBHOOKS_MODEL
  • OPENCLAW_WEBHOOKS_THINKING
  • OPENCLAW_WEBHOOKS_AGENT_TIMEOUT_SECONDS
  • OPENCLAW_WEBHOOKS_SESSION_KEY_PREFIX

Error Handling

  • Invalid env configuration exits with code 2.
  • In idle mode, unsupported IDLE returns explicit error and suggests IMAP_IDLE_MODE=poll.
  • Runtime failures are emitted as type=error.
  • Command exits non-zero when account processing errors occur.

References

  • references/env.md

Assets

  • assets/config.example.env

Scripts

  • scripts/imap_idle_fetch.py
how to use email-imap-fetch

How to use email-imap-fetch on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add email-imap-fetch
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/tiangong-ai/skills --skill email-imap-fetch

The skills CLI fetches email-imap-fetch from GitHub repository tiangong-ai/skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/email-imap-fetch

Reload or restart Cursor to activate email-imap-fetch. Access the skill through slash commands (e.g., /email-imap-fetch) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.644 reviews
  • Fatima Harris· Dec 20, 2024

    I recommend email-imap-fetch for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Dhruvi Jain· Dec 16, 2024

    email-imap-fetch reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Evelyn Thomas· Dec 12, 2024

    email-imap-fetch reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Chinedu Yang· Nov 11, 2024

    email-imap-fetch reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Oshnikdeep· Nov 7, 2024

    I recommend email-imap-fetch for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Li Yang· Nov 3, 2024

    I recommend email-imap-fetch for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Evelyn Anderson· Nov 3, 2024

    Solid pick for teams standardizing on skills: email-imap-fetch is focused, and the summary matches what you get after install.

  • Ganesh Mohane· Oct 26, 2024

    Useful defaults in email-imap-fetch — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Li Abebe· Oct 22, 2024

    Useful defaults in email-imap-fetch — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Michael Harris· Oct 22, 2024

    email-imap-fetch has been reliable in day-to-day use. Documentation quality is above average for community skills.

showing 1-10 of 44

1 / 5