Email Bridge Skill
Email management skill for OpenClaw. Provides real-time email monitoring with smart categorization and clean notifications for AI assistants.
Features
- Real-time notifications : IMAP IDLE (QQ/NetEase) + polling (Gmail) Smart categorization : 7 categories with subject-only classificationVerification code extraction : Context-aware, low false positive rateHTML content sanitization : Clean text from HTML emails, remove invisible charsPrompt injection protection : Safe email content for AI processingMulti-provider support : Gmail (API), QQ Mail (IMAP), NetEase (IMAP)
Installation
CODEBLOCK0
Setup (Manual CLI Required)
⚠️ Security Note : Do NOT share authorization codes in chat. Configure accounts via CLI only.
CODEBLOCK1
Getting Authorization Codes
QQ Mail: https://service.mail.qq.com/detail/0/75 (send SMS, get 16-char code)
NetEase (163/126): Settings → POP3/SMTP/IMAP → Enable → Get code
Gmail: Requires OAuth setup (see README.md)
Capabilities
- Receive emails : Sync and read emails from configured accounts Send emails : Send emails via SMTPReal-time notifications : Push to OpenClaw via INLINECODE0Smart categorization : 7 categories with keyword-based classificationVerification code extraction : Context-aware extraction with low false positivesLink extraction : Extract action links from emailsHTML sanitization : Clean text extraction with invisible char removalPrompt injection protection : Sanitize email content for safe AI processing
Email Categories
Subject-only classification for fast, reliable categorization:
Category Icon Description Example Keywords verification 🔐 Verification codes, activation 验证码, OTP, activate, 绑定邮箱 security
⚠️ | Security alerts, login warnings | 安全提醒, security alert, 密码修改 |
| transactional | 📦 | Orders, payments, shipping | 订单确认, receipt, 发货通知 |
| promotion | 🎁 | Marketing, promotions, rewards | 奖励, 优惠, promo, discount |
| subscription | 📰 | Newsletters, digests | newsletter, 订阅, weekly digest |
| spam_like | 🚫 | Suspected spam | 中奖, FREE, click here now |
| normal | — | Regular email | (default) |
Trigger Keywords
Chinese: 邮箱、邮件、发邮件、查看邮件、验证码、QQ邮箱、Gmail
English: email, mail, send email, check email, verification code
Common Commands
CODEBLOCK2
Configuration
Configuration file: INLINECODE1
Default configuration (auto-generated, minimal):
CODEBLOCK3
Full configuration with all options (customize as needed):
CODEBLOCK4
Notification Options
Option Default Description INLINECODE2 INLINECODE3 Include email body preview in notifications INLINECODE4
500 | Max characters for body preview |
|
include_verification_codes |
true | Auto-extract and show verification codes |
|
include_links |
false | Include action links (verify/reset) |
Notifications
When new emails arrive, the daemon sends formatted notifications:
CODEBLOCK5
HTML Content Processing
HTML-only emails are processed through:
1. Tag stripping : Remove <style>, <script>, and all HTML tags Entity decoding : Convert HTML entities to textInvisible char removal : Remove zero-width spaces, BOM, etc.Whitespace normalization : Clean up spacingPrompt injection protection : Remove dangerous patterns
Example : HTML with invisible chars → Clean readable text
Security Features
- Subject-only classification : No body scanning for privacy Context-aware code extraction : Only extract near verification keywordsInvisible char sanitization : Remove U+200B, U+FEFF, U+034F, etc.Prompt injection protection : Filter dangerous instruction patternsAddress pattern exclusion : Don't extract numbers from addresses
Data Storage
All data stored locally at ~/.email-bridge/:
CODEBLOCK6
⚠️ Credentials are stored unencrypted. Protect this directory.
Revoking Access
CODEBLOCK7
Dependencies
All from PyPI:
- click >= 8.0 pydantic >= 2.0 imaplib2 >= 3.6 google-api-python-client >= 2.0 (Gmail only) google-auth-oauthlib >= 1.0 (Gmail only)
Security Notes
1. Never share authorization codes in chat - use CLI interactively Credentials stored unencrypted - protect ~/.email-bridge/ directoryEmail content is sanitized - prompt injection protection enabledDaemon runs with user privileges - no elevated access neededSubject-only classification - privacy-conscious processing
Changelog
v0.6.2
- Add PROMOTION category for marketing emails (🎁 icon) Add TRANSACTIONAL category for orders/shipping (📦 icon) Expand keyword pools for all categories Add invisible character sanitization (U+200B, U+FEFF, U+034F, etc.) Improve HTML-to-text extraction Update documentation (DESIGN.md, README.md)
v0.6.1
- Add IDLE keepalive (60s timeout) for connection stability Add sync retry mechanism (up to 3 retries) Improve daemon reliability for flaky networks
v0.6.0
- Smart notification format based on email category Prompt injection protection with INLINECODE14 HTML-to-text fallback for HTML-only emails Subject-only classification for privacy Context-aware verification code extraction Category icons (🔐 ⚠️ 📦 🎁 📰 🚫)
v0.5.7
- Initial ClawHub release Gmail, QQ Mail, NetEase support IMAP IDLE real-time notifications Verification code extraction Link extraction
邮件桥接技能
OpenClaw的邮件管理技能。提供实时邮件监控,具备智能分类和简洁通知功能,适用于AI助手。
功能特性
- 实时通知 :IMAP IDLE(QQ/网易)+ 轮询(Gmail) 智能分类 :7个类别,仅基于主题进行分类验证码提取 :上下文感知,低误报率HTML内容净化 :从HTML邮件中提取纯净文本,移除不可见字符提示注入防护 :确保邮件内容可安全用于AI处理多提供商支持 :Gmail(API)、QQ邮箱(IMAP)、网易邮箱(IMAP)
安装
bash
cd skills/email-bridge
pip install -e .
设置(需手动使用CLI)
⚠️ 安全提示 :请勿在聊天中分享授权码。仅通过CLI配置账户。
bash
添加账户(安全提示输入授权码)
email-bridge accounts add your@qq.com -p qq
同步邮件
email-bridge sync
启动守护进程以接收实时通知
email-bridge daemon start -d
获取授权码
QQ邮箱: https://service.mail.qq.com/detail/0/75(发送短信,获取16位授权码)
网易邮箱(163/126): 设置 → POP3/SMTP/IMAP → 开启 → 获取授权码
Gmail: 需要OAuth设置(详见README.md)
能力
- 接收邮件 :从已配置账户同步和读取邮件 发送邮件 :通过SMTP发送邮件实时通知 :通过openclaw system event推送到OpenClaw智能分类 :7个类别,基于关键词分类验证码提取 :上下文感知提取,低误报率链接提取 :从邮件中提取操作链接HTML净化 :提取纯净文本,移除不可见字符提示注入防护 :净化邮件内容,确保AI处理安全
邮件分类
仅基于主题进行分类,实现快速可靠的分类:
类别 图标 描述 示例关键词 验证 🔐 验证码、激活 验证码, OTP, activate, 绑定邮箱 安全
⚠️ | 安全警报、登录警告 | 安全提醒, security alert, 密码修改 |
| 交易 | 📦 | 订单、支付、物流 | 订单确认, receipt, 发货通知 |
| 推广 | 🎁 | 营销、促销、奖励 | 奖励, 优惠, promo, discount |
| 订阅 | 📰 | 新闻通讯、摘要 | newsletter, 订阅, weekly digest |
| 疑似垃圾 | 🚫 | 疑似垃圾邮件 | 中奖, FREE, click here now |
| 普通 | — | 常规邮件 | (默认) |
触发关键词
中文: 邮箱、邮件、发邮件、查看邮件、验证码、QQ邮箱、Gmail
英文: email, mail, send email, check email, verification code
常用命令
bash
列出最近邮件
email-bridge messages list -n 10
从最近邮件中获取验证码
email-bridge codes
发送邮件
email-bridge send -a
-t recipient@example.com -s 主题 -b 正文
守护进程管理
email-bridge daemon status
email-bridge daemon stop
配置
配置文件:~/.email-bridge/config.json
默认配置 (自动生成,最小化):
json
{
daemon: {
poll_interval: 300,
notify_openclaw: true
}
}
包含所有选项的完整配置 (按需自定义):
json
{
daemon: {
poll_interval: 300,
notify_openclaw: true,
notification: {
include_body: false,
bodymax length: 500,
includeverification codes: true,
include_links: false
}
}
}
通知选项
选项 默认值 描述 includebody false 在通知中包含邮件正文预览 bodymax_length
500 | 正文预览的最大字符数 |
| includeverification codes | true | 自动提取并显示验证码 |
| include_links | false | 包含操作链接(验证/重置) |
通知
当新邮件到达时,守护进程会发送格式化通知:
📧 新邮件: account@qq.com
1. 🔐 Google
您的验证码
✨ 验证码: 123456
2. ⚠️ Microsoft
登录提醒
📝 We noticed a new sign-in...
3. 🎁 OKX
150 USDT 奖励等您拿
📝 亲爱的欧易用户,欧易诚邀您加入邀请好友计划...
HTML内容处理
纯HTML邮件经过以下处理流程:
1. 标签剥离 :移除