skills/email-automation/SKILL.md
邮箱自动化:读取、搜索、草拟和发送邮件,支持 Gmail API 以及通用 IMAP/SMTP 流程。
npx skillsauth add aaaaqwq/agi-super-team email-automationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
邮箱自动化:读取、搜索、草拟、发送邮件。
优点: 功能完整,支持标签、搜索、草稿 配置步骤:
credentials.json~/.config/gmail/credentials.json# 安装依赖
pip3 install google-auth-oauthlib google-api-python-client
# 首次授权(会打开浏览器)
python3 ~/clawd/skills/email-automation/gmail_auth.py
优点: 支持任何邮箱 配置:
# 存储凭据
pass insert email/gmail-address # 邮箱地址
pass insert email/gmail-app-pass # 应用专用密码(非登录密码)
Gmail 应用专用密码获取:
使用 n8n 的 Gmail/IMAP 节点,通过 webhook 触发。
# gmail_read.py
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
creds = Credentials.from_authorized_user_file('token.json')
service = build('gmail', 'v1', credentials=creds)
# 获取最新 10 封邮件
results = service.users().messages().list(
userId='me', maxResults=10, q='is:unread'
).execute()
for msg in results.get('messages', []):
detail = service.users().messages().get(
userId='me', id=msg['id'], format='metadata'
).execute()
headers = {h['name']: h['value'] for h in detail['payload']['headers']}
print(f"From: {headers.get('From')}")
print(f"Subject: {headers.get('Subject')}")
print("---")
# Gmail 搜索语法
queries = {
"未读": "is:unread",
"今天": "newer_than:1d",
"重要": "is:important",
"带附件": "has:attachment",
"来自某人": "from:[email protected]",
"主题包含": "subject:关键词",
}
# gmail_send.py
import base64
from email.mime.text import MIMEText
def create_message(to, subject, body):
message = MIMEText(body)
message['to'] = to
message['subject'] = subject
raw = base64.urlsafe_b64encode(message.as_bytes()).decode()
return {'raw': raw}
def send_email(service, to, subject, body):
message = create_message(to, subject, body)
service.users().messages().send(userId='me', body=message).execute()
import imaplib
import email
# 连接
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login(EMAIL, APP_PASSWORD)
mail.select('inbox')
# 搜索未读
status, messages = mail.search(None, 'UNSEEN')
for num in messages[0].split():
status, data = mail.fetch(num, '(RFC822)')
msg = email.message_from_bytes(data[0][1])
print(f"From: {msg['from']}")
print(f"Subject: {msg['subject']}")
| 操作 | 权限级别 | |------|----------| | 读取邮件列表 | 🟢 自由 | | 读取邮件内容 | 🟢 自由 | | 搜索邮件 | 🟢 自由 | | 创建草稿 | 🟢 自由 | | 发送邮件 | 🟡 需确认 | | 删除邮件 | 🟡 需确认 | | 修改标签 | 🟢 自由 |
⚠️ 需要确认发送邮件:
收件人: [email protected]
主题: Re: 关于项目进度
内容预览:
---
你好,
关于项目进度...
---
回复 "确认" 发送,或 "取消" 放弃
每天早上检查未读邮件,生成摘要推送到 Telegram
监控特定发件人/关键词,立即通知
收到邮件后自动生成回复草稿,等待确认后发送
完成配置后,在 TOOLS.md 中记录:
### Email
- Provider: Gmail
- Address: [email protected]
- Auth: OAuth 2.0 / App Password
- Token: ~/.config/gmail/token.json
- 权限: 读取 ✅ | 发送 ⚠️需确认
gmail_auth.py - OAuth 授权脚本gmail_read.py - 读取邮件gmail_send.py - 发送邮件SECURITY.md - 安全策略development
Technology-agnostic prompt generator that creates customizable AI prompts for scanning codebases and identifying high-quality code exemplars. Supports multiple programming languages (.NET, Java, JavaScript, TypeScript, React, Angular, Python) with configurable analysis depth, categorization methods, and documentation formats to establish coding standards and maintain consistency across development teams.
tools
Expert-level browser automation, debugging, and performance analysis using Chrome DevTools MCP. Use for interacting with web pages, capturing screenshots, analyzing network traffic, and profiling performance.
data-ai
Prompt for creating detailed feature implementation plans, following Epoch monorepo structure.
tools
Interactive prompt refinement workflow: interrogates scope, deliverables, constraints; copies final markdown to clipboard; never writes code. Requires the Joyride extension.