gmail-no-send
Gmail CLI that cannot send email. Not "won't" — can't. There is no send function in the codebase.
Install
Requires Python 3.9+.
CODEBLOCK0
Or install from the GitHub repo:
CODEBLOCK1
First-Time Auth
Each user needs their own Google Cloud OAuth credentials:
- 1. Create a project at console.cloud.google.com
- Enable the Gmail API
- Create OAuth 2.0 credentials (Desktop app type)
- Download INLINECODE0
Then authenticate:
CODEBLOCK2
This opens a browser for Google OAuth consent. Token is saved to ~/.config/gmail-no-send/token.json and auto-refreshes.
Commands
All commands require --account <name> (matches the name used during auth).
Search
gmail-no-send search --account mei --query "from:someone@example.com newer_than:7d" --max 10
Returns JSON array of message IDs and thread IDs.
Read
gmail-no-send read --account mei --message-id <id>
Returns full message payload (headers, body, labels).
Create Draft
CODEBLOCK5
Update Draft
CODEBLOCK6
Archive
gmail-no-send archive --account mei --message-id <id>
Removes INBOX label (message stays in All Mail).
Security Model
- - No send command exists. The CLI has 6 commands: auth, search, read, draft-create, draft-update, archive. None send.
- OAuth scope caveat: Gmail API has no "drafts-only" scope. The
compose scope technically allows send via API. This tool enforces no-send at the application layer — the code simply doesn't call the send endpoint. - Audit log: All operations logged to
~/.config/gmail-no-send/audit.log with timestamps. - Token storage:
~/.config/gmail-no-send/token.json — user-local, not shared.
For a deeper security analysis, see references/threat-model.md.
Agent Usage Notes
- - Search returns message IDs, not content. Call
read to get the actual message. - Draft creation returns the draft ID for future updates.
- Use
--body-file for long draft bodies instead of --body to avoid shell escaping issues. - The tool does NOT support attachments, labels, or filters — intentionally minimal.
gmail-no-send
一个无法发送邮件的Gmail命令行工具。不是不会——而是不能。代码库中根本没有发送功能。
安装
需要Python 3.9及以上版本。
bash
cd <技能目录>/scripts/gmail-no-send
pip install -e .
或从GitHub仓库安装:
bash
pip install git+https://github.com/meimakes/gmail-no-send.git
首次认证
每个用户需要自己的Google Cloud OAuth凭据:
- 1. 在 console.cloud.google.com 创建项目
- 启用Gmail API
- 创建OAuth 2.0凭据(桌面应用类型)
- 下载 client_secret.json
然后进行认证:
bash
gmail-no-send auth --client-secret /path/to/client_secret.json --account myname
此操作会打开浏览器进行Google OAuth授权。令牌保存至 ~/.config/gmail-no-send/token.json 并自动刷新。
命令
所有命令都需要 --account <名称> 参数(与认证时使用的名称一致)。
搜索
bash
gmail-no-send search --account mei --query from:someone@example.com newer_than:7d --max 10
返回消息ID和线程ID的JSON数组。
读取
bash
gmail-no-send read --account mei --message-id
返回完整消息载荷(标头、正文、标签)。
创建草稿
bash
gmail-no-send draft-create --account mei --to someone@example.com --subject Re: topic --body 此处为草稿文本
gmail-no-send draft-create --account mei --to someone@example.com --subject 长草稿 --body-file /path/to/body.txt
更新草稿
bash
gmail-no-send draft-update --account mei --draft-id --to someone@example.com --subject 已更新 --body 新正文
归档
bash
gmail-no-send archive --account mei --message-id
移除收件箱标签(邮件仍保留在所有邮件中)。
安全模型
- - 不存在发送命令。 该CLI有6个命令:auth、search、read、draft-create、draft-update、archive。均无发送功能。
- OAuth作用域注意事项: Gmail API没有仅草稿作用域。compose作用域理论上允许通过API发送。本工具在应用层强制实现无发送——代码根本不调用发送端点。
- 审计日志: 所有操作均记录至 ~/.config/gmail-no-send/audit.log,包含时间戳。
- 令牌存储: ~/.config/gmail-no-send/token.json — 用户本地存储,不共享。
如需更深入的安全分析,请参阅 references/threat-model.md。
代理使用说明
- - 搜索返回消息ID,而非内容。调用 read 获取实际消息。
- 创建草稿会返回草稿ID,用于后续更新。
- 长草稿正文请使用 --body-file 而非 --body,以避免shell转义问题。
- 本工具不支持附件、标签或过滤器——有意保持最小化功能。