npx skills add https://github.com/tiangong-ai/skills --skill email-imap-fetchidle 或 poll)严格控制 IDLE 支持,无需运行时探测。配置账户环境变量和 OpenClaw webhook 环境变量(参见 references/env.md 和 assets/config.example.env)。
验证配置:
python3 scripts/imap_idle_fetch.py check-config
为每个账户运行一个 IDLE 周期(冒烟测试):
python3 scripts/imap_idle_fetch.py listen --cycles 1 --idle-seconds 120 --max-messages 10
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
持续运行(默认常驻模式):
python3 scripts/imap_idle_fetch.py listen
idle 模式下,IMAP IDLE 仅在监听器进程和 IMAP 连接存活时接收推送事件。poll 模式下,监听器休眠轮询间隔时间,然后获取未读邮件。UNSEEN 获取现有的未读邮件。IMAP_CYCLES=0)。poll(对于不支持 IDLE 的服务器安全)。systemd、launchd、supervisor 或等效的守护进程管理器下运行。type=status 用于生命周期事件。type=message 用于获取到的邮件,包含:
account、mailbox、seq、uidsubject、from、to、datemessage_id_raw、message_id_norm(以及兼容字段 message_id)snippet(仅纯文本预览)attachment_count、attachment_manifest(仅摘要,无附件内容)mail_ref 机器可读对象(account、mailbox、uid、message_id_raw、message_id_norm、date)<<<MAIL_REF_JSON>>> ... <<<END_MAIL_REF_JSON>>><<<ATTACHMENT_MANIFEST_JSON>>> ... <<<END_ATTACHMENT_MANIFEST_JSON>>>wait_mode 在周期状态输出中为 idle 或 poll。wait_events 记录活动的等待策略详情。event=webhook_delivered 状态事件。type=error 用于账户级故障。event=webhook_failed 错误事件。--cycles: 每个账户的 IDLE 周期数(0 表示永久)。--idle-seconds: 每次 IDLE 调用的最大等待时间。--poll-seconds: 轮询模式激活时使用的间隔时间。--idle-mode: idle 或 poll。--max-messages: 每个周期获取的最大未读邮件数。--mark-seen / --no-mark-seen: 控制未读状态更新。--snippet-chars: 预览长度限制。--connect-timeout: 连接超时秒数。--retry-seconds: 失败后的重试延迟。环境变量默认值:
IMAP_CYCLESIMAP_IDLE_MODEIMAP_IDLE_SECONDSIMAP_POLL_SECONDSIMAP_MAX_MESSAGESIMAP_MARK_SEENIMAP_SNIPPET_CHARSIMAP_CONNECT_TIMEOUTIMAP_RETRY_SECONDSOpenClaw webhook 转发:
OPENCLAW_WEBHOOKS_ENABLEDOPENCLAW_WEBHOOKS_TOKENOPENCLAW_WEBHOOKS_BASE_URLOPENCLAW_WEBHOOKS_MODE (agent 或 wake)OPENCLAW_WEBHOOKS_ENDPOINT(可选的端点覆盖)OPENCLAW_WEBHOOKS_PATHOPENCLAW_WEBHOOKS_WAKE_MODEOPENCLAW_WEBHOOKS_DELIVEROPENCLAW_WEBHOOKS_TIMEOUTOPENCLAW_WEBHOOKS_NAMEOPENCLAW_WEBHOOKS_AGENT_IDOPENCLAW_WEBHOOKS_CHANNELOPENCLAW_WEBHOOKS_TOOPENCLAW_WEBHOOKS_MODELOPENCLAW_WEBHOOKS_THINKINGOPENCLAW_WEBHOOKS_AGENT_TIMEOUT_SECONDSOPENCLAW_WEBHOOKS_SESSION_KEY_PREFIX2 退出。idle 模式下,不支持的 IDLE 返回显式错误并建议 IMAP_IDLE_MODE=poll。type=error 形式发出。references/env.mdassets/config.example.envscripts/imap_idle_fetch.py每周安装次数
119
代码仓库
GitHub Stars
4
首次出现
2026年2月23日
安全审计
安装于
github-copilot115
codex115
opencode115
kimi-cli114
gemini-cli114
amp114
idle or poll) without runtime probing.references/env.md and assets/config.example.env).python3 scripts/imap_idle_fetch.py check-config
python3 scripts/imap_idle_fetch.py listen --cycles 1 --idle-seconds 120 --max-messages 10
python3 scripts/imap_idle_fetch.py listen
idle mode, IMAP IDLE receives push events only while listener process and IMAP connection are alive.poll mode, listener sleeps for poll interval and then fetches unread messages.UNSEEN.IMAP_CYCLES=0 by default).poll (safe for servers without IDLE support).systemd, launchd, supervisor, or an equivalent daemon manager.type=status for lifecycle events.type=message for fetched emails with:
account, mailbox, seq, uidsubject, from, to, datemessage_id_raw, (and compatibility field )--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.Environment defaults:
IMAP_CYCLESIMAP_IDLE_MODEIMAP_IDLE_SECONDSIMAP_POLL_SECONDSIMAP_MAX_MESSAGESIMAP_MARK_SEENIMAP_SNIPPET_CHARSIMAP_CONNECT_TIMEOUTIMAP_RETRY_SECONDSOpenClaw webhooks forwarding:
OPENCLAW_WEBHOOKS_ENABLEDOPENCLAW_WEBHOOKS_TOKENOPENCLAW_WEBHOOKS_BASE_URLOPENCLAW_WEBHOOKS_MODE (agent or wake)OPENCLAW_WEBHOOKS_ENDPOINT (optional endpoint override)OPENCLAW_WEBHOOKS_PATHOPENCLAW_WEBHOOKS_WAKE_MODEOPENCLAW_WEBHOOKS_DELIVER2.idle mode, unsupported IDLE returns explicit error and suggests IMAP_IDLE_MODE=poll.type=error.references/env.mdassets/config.example.envscripts/imap_idle_fetch.pyWeekly Installs
119
Repository
GitHub Stars
4
First Seen
Feb 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
github-copilot115
codex115
opencode115
kimi-cli114
gemini-cli114
amp114
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
40,000 周安装
message_id_normmessage_idsnippet (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)<<<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.--snippet-chars: preview length limit.--connect-timeout: connection timeout seconds.--retry-seconds: retry delay after failure.OPENCLAW_WEBHOOKS_TIMEOUTOPENCLAW_WEBHOOKS_NAMEOPENCLAW_WEBHOOKS_AGENT_IDOPENCLAW_WEBHOOKS_CHANNELOPENCLAW_WEBHOOKS_TOOPENCLAW_WEBHOOKS_MODELOPENCLAW_WEBHOOKS_THINKINGOPENCLAW_WEBHOOKS_AGENT_TIMEOUT_SECONDSOPENCLAW_WEBHOOKS_SESSION_KEY_PREFIX