LM

leeguooooo/mail-use

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

47 stars 8 forks 质量 84 趋势 27MIT

面向AI代理的电子邮件——读取、搜索、发送并分流来自CLI或MCP的Gmail / QQ / 163 / 任何IMAP。属于*-use家族。

概览

一个CLI通过Gmail、QQ、163、Outlook以及任何IMAP/SMTP设备——每个命令都用JSON通信,所有破坏性命令都经过演练,直到你通过——确认。 *-use家族的一部分——每个小工具都能让特工亲手操作一个真实的东西。 - 每个响应都带有成功:布尔值,失败则从固定集合(auth_failed、folder_not_found、imap_error 等)error_code。文档有文档CLI_JSON_CONTRACT.md。- 缓存读取报告from_cache、cache_age_seconds和cache_stale,且足够老的快照表示“无同步”被拒绝,转而使用实时取用。空收件箱绝不会是无声的“无物到达”。- 删除/标记/移动/发送返回预演预览——按账户和文件夹分组,包含示例主题——且在确认前不更改。--所有文件夹除非被要求,跳过发送/草稿/垃圾/废弃。

概述(AI 翻译)

电子邮件,作为AI代理能够实际操作的东西。 一个CLI通过Gmail、QQ, 163、Outlook 以及任何 IMAP/SMTP 服务器——每个命令都用 JSON,每个破坏性命令 其中一种是通过--confirm的模拟演练。

属于*-use家族——每个工具都赋予一个代理人 亲手碰到一件真正的事。

为什么是这个,而不是IMAP的片段

  • 稳定的JSON合同,非抓取文本。 每个响应都携带 success: boolean,失败则从固定集合中承载error_code (auth_failed、folder_not_found、imap_error, …)记录在 docs/CLI_JSON_CONTRACT.md。
  • 它会告诉你何时可能错误。 缓存读取报告 from_cache, cache_age_seconds 和 cache_stale,还有一张足够古老的快照,意味着“什么都没有” 正在同步“被拒绝,转而采用实时取用。空收件箱永远不会是静音 “什么都没到。”
  • 仅凭同意破坏。 delete / mark / move / send 返回 预演预览——按账户和文件夹分组,附有示例主题——并进行更改 直到--confirm之前都没有。--all-folders除非被要求,否则跳过发送/草稿/垃圾/垃圾。
  • 为代币预算设计。 --format compact 每封邮件都向十人项目

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mail-use

Email, as something an AI agent can actually operate. One CLI over Gmail, QQ, 163, Outlook and any IMAP/SMTP box — every command speaks JSON, every destructive one is dry-run until you pass --confirm.

mail-use code --json          # the newest verification code, one live pass
mail-use email recent --format compact --json
mail-use email delete --from [email protected] --confirm --json

Part of the *-use family — small tools that each give an agent hands on one real thing.

Why this and not an IMAP snippet

  • A stable JSON contract, not scraped text. Every response carries success: boolean, and failures carry error_code from a fixed set (auth_failed, folder_not_found, imap_error, …). Documented in docs/CLI_JSON_CONTRACT.md.
  • It tells you when it might be wrong. Cached reads report from_cache, cache_age_seconds and cache_stale, and a snapshot old enough to mean “nothing is syncing” is refused in favour of a live fetch. An empty inbox is never a silent “nothing arrived”.
  • Destructive by consent only. delete / mark / move / send return a dry-run preview — grouped per account and folder, with sample subjects — and change nothing until --confirm. --all-folders skips Sent/Drafts/Junk/Trash unless asked.
  • Built for token budgets. --format compact projects each email to the ten fields worth scanning (~30% smaller than the full shape), --with-preview folds a body snippet into the list call, and batch show reuses one IMAP connection.
  • Fast enough to call in a loop. A persistent daemon pools IMAP connections and syncs to local SQLite in the background: five sequential email list calls go from 25s to 0.83s. See the table below.
  • MCP too. mail-use mcp config --json prints a paste-ready entry; the server exposes 16 tools with the same dry-run defaults.

Renamed from Mailbox to mail-use. The command is now mail-use; mailbox still works as an alias, and your config in ~/.config/mailbox is untouched.

Supported providers

163 / 126 · QQ · Gmail · Outlook / Hotmail · any custom IMAP+SMTP server.

Search behaves differently per provider and the CLI says so: Gmail searches bodies server-side via X-GM-RAW, while QQ/163/Outlook have broken IMAP TEXT search, so --query falls back to matching subject + sender only. Use --from / --subject there for predictable results.

Install

One line, no npm, no Node

curl -fsSL https://raw.githubusercontent.com/leeguooooo/mail-use/main/install.sh | sh
mail-use --help

Downloads the prebuilt binary for your platform (macOS arm64/x64, Linux x64/arm64) from the latest GitHub Release, verifies its checksum, and installs to ~/.local/bin. Pin a version with MAIL_USE_VERSION=v2.11.2, or

在 GitHub 查看完整 README

安装

npx skills update mail-use` for you to run).
新手?先看 mcpskill.org 教程 →