Skip to main content

nmail-cli

Nmail 对外 API 的命令行客户端(AGENT_SKILL_PLAN P2 / REDESIGN_PLAN §19)——为外部 agent 与 skill 设计:JSON envelope(stdout)、exit code 契约、发送类两阶段确认。

安装

uvx nmail-cli@latest --help     # 零安装(PyPI 发布后)
# 或
pipx install nmail-cli

发布随主仓发版流程进行(nmail-cli 为独立 PyPI 包名)。

快速上手

nmail-cli auth login                 # 本机 Nmail(127.0.0.1:8720)自动配对建 Key(默认 read scope)
nmail-cli auth login --scopes read,write,send   # 需要发送时显式扩权
nmail-cli +me                        # 账号列表与健康
nmail-cli emails list --limit 5
nmail-cli emails read 254 --save-attachments ./downloads
nmail-cli drafts reply --email-id 254 --body-file ./reply.md
nmail-cli drafts send 44             # 第一阶段:打印摘要,exit 8
nmail-cli drafts send 44 --confirmed # 第二阶段:用户许可后重放
nmail-cli watch                      # NDJSON 每行一封新邮件

远程(自建隧道):nmail-cli auth login --base-url https://nmail.example.com --key nmail_xxx (/api/extkeys 管理面仅本机可达,远程需从 Nmail 设置-API 复制 Key 粘贴)。

契约

  • stdout 只输出 JSON envelope:成功 {"ok":true,"data":…},失败 {"ok":false,"error":{"code","message",…}};人话日志走 stderr。
  • exit code:0 成功 · 1 上游 5xx 可重试×2 · 2 参数不合规不重试 · 3 认证失效/未启用 走 auth login · 4 连不上(检查 Nmail 是否运行/隧道) · 6 业务永久拒绝不重试 · 7 限流按 Retry-After 等待 · 8 需两阶段确认(停下等用户,不得同轮自确认)。
  • 配置:~/.config/nmail-cli/config.json(0600);环境变量 NMAIL_BASE_URL / NMAIL_API_KEY 可覆盖(CI/一次性场景)。

服务端 API 与安全模型见 docs/对外API使用指南.md;面向 agent 的技能说明见 skills/SKILL.md(P3)。

Metadata

Release files for nmail-cli 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nmail-cli 0.4.4
File Size Uploaded
nmail_cli-0.4.4.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nmail-cli 0.4.4
File Interpreter ABI Platform
nmail_cli-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 31.2 kB

Release files / nmail_cli-0.4.4.tar.gz

Download URL nmail_cli-0.4.4.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0c8a010acd30be252487f77843e92db9a2b08e5db12647ae22fdcf9e4a33163a
BLAKE2b-256 checksum
How to use checksums
3b4b4f4b63687a1d8aa46c282e8e6ae6695d5e3a6a3adb6f7355fb4496928b34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / nmail_cli-0.4.4-py3-none-any.whl

Download URL nmail_cli-0.4.4-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb19f8820af26af7a8e2cbf16f2ec1c311470321e416cdbe3d549f8acbba0d98
BLAKE2b-256 checksum
How to use checksums
4070e38efde92087b714dd6e949b246837bcab781a5fd4e0f68399cc24794ceb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page