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

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

Built distribution (wheel)

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

Total release size: 31.2 kB

Release files / nmail_cli-0.4.3.tar.gz

Download URL nmail_cli-0.4.3.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
34f7b14b82eeab785be57601551504293e1dc972794ea8b39a59f6166a217820
BLAKE2b-256 checksum
How to use checksums
69a3968dcc4b3d60eea74966b70890354eabf5482006861b01bdf0ef74d25fd7
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.3-py3-none-any.whl

Download URL nmail_cli-0.4.3-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d43661ecb143bd81981f2c6d9e5e65349870d397c5c40ddcc127e25a155427c
BLAKE2b-256 checksum
How to use checksums
765424b48d3a67c7981ca0af4e61d6b0aae9a892244c7987d5ec3029312b4288
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

0.4.4

2 release files

This release

0.4.3 This release

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