gmail
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGmail Skill
Gmail Skill
Overview
概述
Claude can fully interact with Gmail to manage your email communications. This includes reading emails, composing and sending messages, searching through mail, managing labels, archiving, and organizing your inbox.
Claude可以与Gmail进行全面交互,管理你的电子邮件通讯。这包括读取邮件、撰写和发送消息、搜索邮件、管理标签、归档以及整理收件箱。
Quick Install
快速安装
bash
curl -sSL https://canifi.com/skills/gmail/install.sh | bashOr manually:
bash
cp -r skills/gmail ~/.canifi/skills/bash
curl -sSL https://canifi.com/skills/gmail/install.sh | bash或者手动安装:
bash
cp -r skills/gmail ~/.canifi/skills/Setup
配置
Configure via canifi-env:
bash
undefined通过canifi-env进行配置:
bash
undefinedFirst, ensure canifi-env is installed:
First, ensure canifi-env is installed:
curl -sSL https://canifi.com/install.sh | bash
curl -sSL https://canifi.com/install.sh | bash
canifi-env set GOOGLE_EMAIL "your-email@gmail.com"
undefinedcanifi-env set GOOGLE_EMAIL "your-email@gmail.com"
undefinedPrivacy & Authentication
隐私与认证
Your credentials, your choice. Canifi LifeOS respects your privacy.
你的凭据,由你做主。 Canifi LifeOS尊重你的隐私。
Option 1: Manual Browser Login (Recommended)
选项1:手动浏览器登录(推荐)
If you prefer not to share credentials with Claude Code:
- Complete the Browser Automation Setup using CDP mode
- Login to the service manually in the Playwright-controlled Chrome window
- Claude will use your authenticated session without ever seeing your password
如果你不想与Claude Code共享凭据:
- 使用CDP模式完成浏览器自动化配置
- 在Playwright控制的Chrome窗口中手动登录该服务
- Claude将使用你的已认证会话,且永远不会看到你的密码
Option 2: Environment Variables
选项2:环境变量
If you're comfortable sharing credentials, you can store them locally:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"Note: Credentials stored in canifi-env are only accessible locally on your machine and are never transmitted.
如果你愿意共享凭据,可以将其存储在本地:
bash
canifi-env set SERVICE_EMAIL "your-email"
canifi-env set SERVICE_PASSWORD "your-password"注意:存储在canifi-env中的凭据仅能在你的本地机器上访问,绝不会被传输。
Capabilities
功能
- Read and summarize unread emails
- Compose and send new emails with attachments
- Reply to and forward emails
- Search emails by sender, subject, date, or content
- Apply, create, and manage labels
- Archive, delete, and move emails
- Mark emails as read/unread or starred
- Manage spam and trash
- Create and manage email filters
- Schedule emails to send later
- Access and manage drafts
- 读取并总结未读邮件
- 撰写并发送带附件的新邮件
- 回复和转发邮件
- 按发件人、主题、日期或内容搜索邮件
- 应用、创建和管理标签
- 归档、删除和移动邮件
- 标记邮件为已读/未读或加星标
- 管理垃圾邮件和垃圾箱
- 创建和管理邮件过滤器
- 安排邮件稍后发送
- 访问和管理草稿
Usage Examples
使用示例
Example 1: Check Unread Emails
示例1:查看未读邮件
User: "Check my unread emails"
Claude: Navigates to Gmail, reads inbox, and provides summary:
"You have 5 unread emails:
1. From John Smith - 'Project Update' (2 hours ago)
2. From Amazon - 'Your order has shipped' (3 hours ago)
..."用户:"查看我的未读邮件"
Claude:导航至Gmail,读取收件箱,并提供摘要:
"你有5封未读邮件:
1. 来自John Smith - '项目更新'(2小时前)
2. 来自Amazon - '你的订单已发货'(3小时前)
..."Example 2: Send an Email
示例2:发送邮件
User: "Send an email to bob@example.com about the meeting tomorrow at 3pm"
Claude: Composes email with subject "Meeting Tomorrow" and body about
the 3pm meeting, then sends it. Confirms: "Email sent to bob@example.com"用户:"给bob@example.com发送一封关于明天下午3点会议的邮件"
Claude:撰写主题为"明天的会议"、内容涉及下午3点会议的邮件,然后发送。确认:"已向bob@example.com发送邮件"Example 3: Search and Summarize
示例3:搜索并总结
User: "Find all emails from my boss this week and summarize them"
Claude: Uses Gmail search with "from:boss@company.com after:2024/01/01",
reads each email, provides consolidated summary of key points.用户:"查找本周我老板发来的所有邮件并总结"
Claude:使用Gmail搜索"from:boss@company.com after:2024/01/01",读取每封邮件,提供关键点的综合摘要。Example 4: Organize Inbox
示例4:整理收件箱
User: "Archive all promotional emails older than 30 days"
Claude: Searches for "category:promotions older_than:30d", selects all,
archives them. Reports: "Archived 47 promotional emails"用户:"归档所有超过30天的促销邮件"
Claude:搜索"category:promotions older_than:30d",选择所有邮件,进行归档。报告:"已归档47封促销邮件"Authentication Flow
认证流程
- Claude navigates to mail.google.com via Playwright MCP
- Enters GOOGLE_EMAIL from canifi-env
- Handles password entry if not already authenticated
- Handles 2FA if prompted (notifies user via iMessage to approve)
- Maintains session cookies for subsequent requests
- Claude通过Playwright MCP导航至mail.google.com
- 从canifi-env中读取GOOGLE_EMAIL
- 如果尚未认证,处理密码输入
- 如果提示需要2FA(双因素认证),通过iMessage通知用户进行批准
- 保留会话Cookie用于后续请求
Selectors Reference
选择器参考
javascript
// Compose button
'div[gh="cm"]' or '[aria-label="Compose"]'
// Email list items
'tr.zA' // Each email row in inbox
// Email subject in list
'.bog span'
// Email sender
'.yW span[email]'
// Search box
'input[aria-label="Search mail"]'
// Send button in compose
'div[aria-label="Send"]'
// To field in compose
'input[aria-label="To recipients"]'
// Subject field
'input[name="subjectbox"]'
// Body field
'div[aria-label="Message Body"]'javascript
// Compose button
'div[gh="cm"]' or '[aria-label="Compose"]'
// Email list items
'tr.zA' // Each email row in inbox
// Email subject in list
'.bog span'
// Email sender
'.yW span[email]'
// Search box
'input[aria-label="Search mail"]'
// Send button in compose
'div[aria-label="Send"]'
// To field in compose
'input[aria-label="To recipients"]'
// Subject field
'input[name="subjectbox"]'
// Body field
'div[aria-label="Message Body"]'Error Handling
错误处理
- Login Failed: Retry 3 times with 5-second delays, then notify user via iMessage
- Session Expired: Re-authenticate automatically using stored credentials
- Rate Limited: Wait 60 seconds and retry with exponential backoff
- 2FA Required: Send iMessage: "Gmail requires 2FA approval. Please check your authenticator."
- Compose Failed: Save draft and notify user of the issue
- Search No Results: Confirm search terms with user, suggest alternatives
- 登录失败:重试3次,每次间隔5秒,然后通过iMessage通知用户
- 会话过期:使用存储的凭据自动重新认证
- 速率限制:等待60秒后重试,采用指数退避策略
- 需要2FA:发送iMessage:"Gmail需要2FA批准,请检查你的认证器。"
- 撰写失败:保存草稿并通知用户问题
- 搜索无结果:与用户确认搜索词,建议替代方案
Self-Improvement Instructions
自我改进说明
When you learn a better way to accomplish a task with Gmail:
- Document the improvement in your response
- Suggest updating this skill file with the new approach
- Include specific selectors or workflows that worked better
- Note any Gmail UI changes that require selector updates
当你学会了使用Gmail完成任务的更好方法时:
- 在你的响应中记录改进内容
- 建议使用新方法更新此技能文件
- 包含更有效的具体选择器或工作流程
- 记录任何需要更新选择器的Gmail UI变化
Notes
注意事项
- Gmail's UI can change; selectors may need periodic updates
- Large attachments (>25MB) require Google Drive integration
- Confidential mode emails have limited functionality
- Some actions may trigger Google security alerts; reassure user this is normal
- For bulk operations, process in batches of 50 to avoid timeouts
- Gmail的UI可能会变化;选择器可能需要定期更新
- 大附件(>25MB)需要Google Drive集成
- 保密模式邮件功能有限
- 某些操作可能会触发Google安全警报;请向用户保证这是正常现象
- 对于批量操作,以50个为一批处理以避免超时