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.5

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.5
File Size Uploaded
nmail_cli-0.4.5.tar.gz 17.2 kB Details

Built distribution (wheel)

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

Total release size: 31.2 kB

Release files / nmail_cli-0.4.5.tar.gz

Download URL nmail_cli-0.4.5.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3475b4d447ae5780267fe105350eea327b4df95f9bcd6f9f80aea7da5dc74ca6
BLAKE2b-256 checksum
How to use checksums
3e3744c3aab6a87fee7d954442875c285708aa8644f78736e0d601edfa0ed233
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.5-py3-none-any.whl

Download URL nmail_cli-0.4.5-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b864f1714a930939bc7442ce9574df59e4ccefcc3fa4c35e6753ece99f1ba99b
BLAKE2b-256 checksum
How to use checksums
4552bf4e1e5742d003acc92cf845cbf506273cac0258d7701e0147995274fc1c
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

This release

0.4.5 This release

2 release files

0.4.4

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