gmail-inbox

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gmail Inbox Management

Gmail收件箱管理

Goal

目标

Check and manage emails across multiple Gmail accounts using unified tooling.
借助统一工具检查并管理多个Gmail账户的邮件。

Scripts

脚本

  • ./scripts/gmail_unified.py
    - Check and manage inboxes
  • ./scripts/gmail_multi_auth.py
    - Authenticate accounts
  • ./scripts/gmail_bulk_label.py
    - Bulk labeling
  • ./scripts/gmail_create_filters.py
    - Create filters
  • ./scripts/gmail_auth.py
    - Auth helper
  • ./scripts/gmail_unified.py
    - 检查并管理收件箱
  • ./scripts/gmail_multi_auth.py
    - 账户认证
  • ./scripts/gmail_bulk_label.py
    - 批量标记标签
  • ./scripts/gmail_create_filters.py
    - 创建筛选规则
  • ./scripts/gmail_auth.py
    - 认证辅助工具

Quick Reference

快速参考

bash
undefined
bash
undefined

Check unread across all accounts

查看所有账户的未读邮件

python3 ./scripts/gmail_unified.py --query "is:unread" --limit 50
python3 ./scripts/gmail_unified.py --query "is:unread" --limit 50

Check specific account only

仅查看特定账户

python3 ./scripts/gmail_unified.py --query "is:unread" --account yourcompany
python3 ./scripts/gmail_unified.py --query "is:unread" --account yourcompany

List registered accounts

列出已注册账户

python3 ./scripts/gmail_unified.py --accounts
python3 ./scripts/gmail_unified.py --accounts

Label and archive emails

标记标签并归档邮件

python3 ./scripts/gmail_unified.py --query "from:notifications@" --label "Notifications" --archive
python3 ./scripts/gmail_unified.py --query "from:notifications@" --label "Notifications" --archive

Mark as read

标记为已读

python3 ./scripts/gmail_unified.py --query "from:noreply@" --mark-read
python3 ./scripts/gmail_unified.py --query "from:noreply@" --mark-read

Dry run (preview)

试运行(预览)

python3 ./scripts/gmail_unified.py --query "subject:invoice" --label "Invoices" --dry-run
undefined
python3 ./scripts/gmail_unified.py --query "subject:invoice" --label "Invoices" --dry-run
undefined

Account Registry

账户注册表

AccountEmailCredentialsToken
youruseryou@example.comcredentials.jsontoken_youruser.json
yourcompanyyou@yourdomain.comcredentials_yourcompany.jsontoken_yourcompany.json
账户名称邮箱凭证文件令牌文件
youruseryou@example.comcredentials.jsontoken_youruser.json
yourcompanyyou@yourdomain.comcredentials_yourcompany.jsontoken_yourcompany.json

Troubleshooting Auth Errors

认证错误排查

"Token file not found"
bash
python3 ./scripts/gmail_multi_auth.py --account yourcompany --email you@yourdomain.com
"invalid_scope: Bad Request"
bash
rm token_youruser.json
python3 ./scripts/gmail_multi_auth.py --account youruser --email you@example.com
"Failed to authenticate" Check that credentials.json exists in root directory.
"Token file not found"(未找到令牌文件)
bash
python3 ./scripts/gmail_multi_auth.py --account yourcompany --email you@yourdomain.com
"invalid_scope: Bad Request"(无效权限范围:请求错误)
bash
rm token_youruser.json
python3 ./scripts/gmail_multi_auth.py --account youruser --email you@example.com
"Failed to authenticate"(认证失败) 确认根目录下存在credentials.json文件。

Required Scopes

所需权限范围

  • gmail.modify
    - Read/write emails
  • gmail.labels
    - Create/manage labels
  • gmail.settings.basic
    - Manage settings
  • spreadsheets
    - Google Sheets access
  • drive
    - Google Drive access
  • gmail.modify
    - 读写邮件
  • gmail.labels
    - 创建/管理标签
  • gmail.settings.basic
    - 管理设置
  • spreadsheets
    - Google Sheets访问权限
  • drive
    - Google Drive访问权限

Credentials Location

凭证文件位置

All credential files should be in the workspace root:
  • credentials.json
    /
    credentials_yourcompany.json
    - OAuth client configs
  • token_*.json
    - Auth tokens (auto-generated)
  • gmail_accounts.json
    - Account registry

所有凭证文件应存放在工作区根目录:
  • credentials.json
    /
    credentials_yourcompany.json
    - OAuth客户端配置文件
  • token_*.json
    - 认证令牌(自动生成)
  • gmail_accounts.json
    - 账户注册表

Schema

架构

Inputs

输入参数

NameTypeRequiredDescription
query
stringNoGmail search query (e.g., 'is:unread')
account
stringNoSpecific account name from registry
limit
integerNoMax emails to fetch (default: 50)
名称类型是否必填描述
query
字符串Gmail搜索查询语句(例如:'is:unread')
account
字符串注册表中的特定账户名称
limit
整数最大获取邮件数(默认值:50)

Outputs

输出参数

NameTypeDescription
emails
arrayList of email objects with subject, from, date, snippet
名称类型描述
emails
数组包含主题、发件人、日期、摘要的邮件对象列表

Credentials

凭证

NameSource
credentials.json
file
token_*.json
file (auto-generated)
名称来源
credentials.json
文件
token_*.json
文件(自动生成)

Composable With

可组合技能

Skills that chain well with this one:
gmail-label
,
instantly-autoreply
与此技能适配性良好的技能:
gmail-label
,
instantly-autoreply

Cost

成本

Free (Gmail API)
免费(基于Gmail API)