gmcli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGmail CLI
Gmail CLI
Command-line interface for Gmail operations.
用于Gmail操作的命令行界面。
Installation
安装
bash
npm install -g @mariozechner/gmclibash
npm install -g @mariozechner/gmcliSetup
配置
Google Cloud Console (one-time)
Google Cloud Console(一次性操作)
- Create a new project (or select existing)
- Enable the Gmail API
- Set app name in OAuth branding
- Add test users (all Gmail addresses you want to use)
- Create OAuth client:
- Click "Create Client"
- Application type: "Desktop app"
- Download the JSON file
- 创建新项目(或选择现有项目)
- 启用Gmail API
- 在OAuth品牌设置中设置应用名称
- 添加测试用户(所有你想使用的Gmail地址)
- 创建OAuth客户端:
- 点击“创建客户端”
- 应用类型:“桌面应用”
- 下载JSON文件
Configure gmcli
配置gmcli
First check if already configured:
bash
gmcli accounts listIf no accounts, guide the user through setup:
- Ask if they have a Google Cloud project with Gmail API enabled
- If not, walk them through the Google Cloud Console steps above
- Have them download the OAuth credentials JSON
- Run:
gmcli accounts credentials ~/path/to/credentials.json - Run: (use
gmcli accounts add <email>for browserless OAuth)--manual
首先检查是否已配置:
bash
gmcli accounts list如果没有账户,引导用户完成设置:
- 询问用户是否拥有已启用Gmail API的Google Cloud项目
- 如果没有,引导用户完成上述Google Cloud Console步骤
- 让用户下载OAuth凭据JSON文件
- 运行:
gmcli accounts credentials ~/path/to/credentials.json - 运行:(使用
gmcli accounts add <email>参数进行无浏览器OAuth验证)--manual
Usage
使用方法
Run for full command reference.
gmcli --helpCommon operations:
- - Search emails using Gmail query syntax
gmcli <email> search "<query>" - - Read a thread with all messages
gmcli <email> thread <threadId> - - Send email
gmcli <email> send --to <emails> --subject <s> --body <b> - - List all labels
gmcli <email> labels list - - List drafts
gmcli <email> drafts list
运行获取完整命令参考。
gmcli --help常见操作:
- - 使用Gmail查询语法搜索邮件
gmcli <email> search "<query>" - - 阅读包含所有消息的对话线程
gmcli <email> thread <threadId> - - 发送邮件
gmcli <email> send --to <emails> --subject <s> --body <b> - - 列出所有标签
gmcli <email> labels list - - 列出草稿
gmcli <email> drafts list
Data Storage
数据存储
- - OAuth client credentials
~/.gmcli/credentials.json - - Account tokens
~/.gmcli/accounts.json - - Downloaded attachments
~/.gmcli/attachments/
- - OAuth客户端凭据
~/.gmcli/credentials.json - - 账户令牌
~/.gmcli/accounts.json - - 已下载的附件
~/.gmcli/attachments/