Email Manager Lite v0.2
A fully self-contained email management skill for OpenClaw. Uses standard IMAP and SMTP protocols with zero external dependencies.
✨ What's New in v0.2
🔍 Advanced Search & Filters
- - Search by sender (
--from) - Search by subject keywords (
--subject) - Filter by date range (
--since, --before) - Filter by read/unread status (
--seen, --unseen) - Search in email body (
--body, warning: can be slow)
📁 Folder Management
- - List all IMAP folders with
folders command - Move emails between folders with
move command - Automatic validation of folder existence
📎 Attachment Information
- - Automatic detection of attachments
- Display attachment details:
- Filename
- MIME type
- File size (formatted KB/MB)
- - Shown in both
read and search results
🔧 Installation
CODEBLOCK0
Dependencies are bundled in package.json:
- -
nodemailer - SMTP email sending - INLINECODE13 - IMAP operations
- INLINECODE14 - Email parsing and attachment detection
🔐 Credentials
Set these environment variables:
CODEBLOCK1
Recommended: Use App Passwords for Gmail, Outlook, Zoho instead of main password.
Provider Setup
Zoho Mail (default):
- - Already configured for
smtp.zoho.eu and INLINECODE16 - Generate App Password: https://accounts.zoho.eu/home#security/apppasswords
Gmail:
- - Edit
scripts/email.js and change:
host: 'smtp.gmail.com' // SMTP
host: 'imap.gmail.com' // IMAP
- - Enable 2FA and create App Password: https://myaccount.google.com/apppasswords
Outlook/Hotmail:
- - Edit to use
smtp.office365.com / INLINECODE19 - Port 587 for SMTP (TLS)
📖 Usage
Send Email
CODEBLOCK3
Example:
CODEBLOCK4
Read Recent Emails
CODEBLOCK5
Examples:
CODEBLOCK6
Output includes:
- - UID (unique ID for moving)
- From/To addresses
- Subject and date
- Attachment count and details
- Email body preview (first 500 chars)
Advanced Search
CODEBLOCK7
Search Options:
| Option | Description | Example |
|---|
| INLINECODE20 | Filter by sender | INLINECODE21 |
| INLINECODE22 |
Filter by subject keywords |
--subject "invoice" |
|
--since <date> | Emails after date |
--since "Jan 1, 2026" |
|
--before <date> | Emails before date |
--before "Feb 1, 2026" |
|
--unseen | Only unread emails |
--unseen |
|
--seen | Only read emails |
--seen |
|
--body <text> | Search in body (slow!) |
--body "meeting" |
|
--limit <n> | Max results |
--limit 10 |
Examples:
CODEBLOCK8
List Folders
CODEBLOCK9
Shows hierarchical tree of all IMAP folders with attributes.
Example output:
CODEBLOCK10
Move Email to Folder
CODEBLOCK11
Important:
- - Get the
uid from read or search output - Folder name is case-sensitive
- Script validates folder exists before moving
Examples:
CODEBLOCK12
Error handling:
- - If folder doesn't exist, shows list of available folders
- Validates UID exists before attempting move
Help
CODEBLOCK13
Shows complete usage guide with all commands and examples.
🎯 Use Cases
Daily Email Triage
CODEBLOCK14
Find Specific Email
CODEBLOCK15
Archive Old Emails
CODEBLOCK16
Check for Attachments
CODEBLOCK17
🔒 Security
- - Credentials never logged or stored in files
- TLS/SSL encryption for all connections
- App Passwords recommended over account passwords
- No data leaves your machine except IMAP/SMTP connections
⚙️ Configuration
Default configuration is optimized for Zoho Mail EU.
To use another provider, edit scripts/email.js:
CODEBLOCK18
🚀 Performance Notes
- - Body search (
--body) can be slow on large mailboxes - use sparingly - Subject/From search is fast - uses IMAP server-side filtering
- Date filters are efficient
- Limit results with
--limit for faster responses
🐛 Troubleshooting
"Authentication failed"
- - Verify EMAILUSER and EMAILPASS are set correctly
- Use App Password, not account password
- Check provider settings (2FA, less secure apps, etc.)
"Folder not found"
- - Use
folders command to see exact folder names - Folder names are case-sensitive
- Some providers use different names (e.g., "Sent Items" vs "Sent")
"Connection timeout"
- - Check firewall/network settings
- Verify IMAP/SMTP ports are accessible
- Try increasing
authTimeout in config
"No emails found"
- - Check search criteria
- Verify emails exist in INBOX (not other folders)
- Try broader search (remove some filters)
📝 Version History
v0.2.0 (Current)
- - ✨ Advanced search with multiple filters
- 📁 Folder management (list, move)
- 📎 Attachment detection and info
- 🎨 Improved output formatting
- 📚 Comprehensive documentation
v0.1.0
- - Basic send/read functionality
- Zoho Mail support
- IMAP/SMTP foundation
🤝 Compatibility
Tested with:
- - ✅ Zoho Mail (EU & US)
- ✅ Gmail
- ✅ Outlook/Hotmail
- ✅ iCloud Mail
- ✅ Custom IMAP/SMTP servers
💡 Tips
- 1. Use UIDs for automation: Save UIDs from search results to move emails programmatically
- Combine filters: Multiple filters create AND conditions for precise searches
- Folder organization: List folders first to plan your organization strategy
- Date format: Use natural language dates like "Jan 1, 2026" or "December 25, 2025"
- Attachment filtering: Look for "Attachments: X" in search output to find emails with files
📄 License
ISC - Use freely in your OpenClaw setup.
技能名称:portable-email-manager
详细描述:
Email Manager Lite v0.2
一个完全自包含的OpenClaw电子邮件管理技能。使用标准IMAP和SMTP协议,零外部依赖。
✨ v0.2 新特性
🔍 高级搜索与筛选
- - 按发件人搜索(--from)
- 按主题关键词搜索(--subject)
- 按日期范围筛选(--since,--before)
- 按已读/未读状态筛选(--seen,--unseen)
- 在邮件正文中搜索(--body,注意:可能较慢)
📁 文件夹管理
- - 使用folders命令列出所有IMAP文件夹
- 使用move命令在文件夹之间移动邮件
- 自动验证文件夹是否存在
📎 附件信息
- 文件名
- MIME类型
- 文件大小(格式化为KB/MB)
🔧 安装
bash
cd skills/portable-email-manager
npm install
依赖项打包在package.json中:
- - nodemailer - SMTP邮件发送
- imap-simple - IMAP操作
- mailparser - 邮件解析和附件检测
🔐 凭据
设置以下环境变量:
bash
export EMAIL_USER=your.email@domain.com
export EMAIL_PASS=your-app-password
推荐: 对Gmail、Outlook、Zoho使用应用密码而非主密码。
提供商设置
Zoho Mail(默认):
- - 已配置smtp.zoho.eu和imap.zoho.eu
- 生成应用密码:https://accounts.zoho.eu/home#security/apppasswords
Gmail:
javascript
host: smtp.gmail.com // SMTP
host: imap.gmail.com // IMAP
- - 启用两步验证并创建应用密码:https://myaccount.google.com/apppasswords
Outlook/Hotmail:
- - 编辑以使用smtp.office365.com / outlook.office365.com
- SMTP端口587(TLS)
📖 使用方法
发送邮件
bash
./scripts/email.js send recipient@example.com Subject Email body text
示例:
bash
./scripts/email.js send boss@company.com Weekly Report Attached is this weeks summary.
读取最近邮件
bash
./scripts/email.js read [limit]
示例:
bash
读取最近5封邮件(默认)
./scripts/email.js read
读取最近20封邮件
./scripts/email.js read 20
输出包括:
- - UID(用于移动的唯一ID)
- 发件人/收件人地址
- 主题和日期
- 附件数量和详情
- 邮件正文预览(前500个字符)
高级搜索
bash
./scripts/email.js search [options]
搜索选项:
| 选项 | 描述 | 示例 |
|---|
| --from <email> | 按发件人筛选 | --from boss@company.com |
| --subject <text> |
按主题关键词筛选 | --subject invoice |
| --since
| 指定日期之后的邮件 | --since Jan 1, 2026 |
| --before | 指定日期之前的邮件 | --before Feb 1, 2026 |
| --unseen | 仅未读邮件 | --unseen |
| --seen | 仅已读邮件 | --seen |
| --body | 在正文中搜索(较慢!) | --body meeting |
| --limit | 最大结果数 | --limit 10 |
示例:
bash
查找来自特定发件人的未读邮件
./scripts/email.js search --from client@example.com --unseen
按主题搜索
./scripts/email.js search --subject invoice --limit 5
日期范围搜索
./scripts/email.js search --since Jan 15, 2026 --before Feb 1, 2026
在正文中搜索(谨慎使用 - 可能较慢)
./scripts/email.js search --body quarterly review
组合多个筛选条件
./scripts/email.js search --from boss@company.com --subject urgent --unseen --limit 3
列出文件夹
bash
./scripts/email.js folders
显示所有IMAP文件夹的层级树及其属性。
示例输出:
📁 INBOX
📁 Sent
📁 Archive
📁 Drafts
📁 Spam
📁 Trash
将邮件移动到文件夹
bash
./scripts/email.js move
重要提示:
- - 从read或search输出中获取uid
- 文件夹名称区分大小写
- 脚本在移动前会验证文件夹是否存在
示例:
bash
首先,找到邮件并记下其UID
./scripts/email.js search --from newsletter@example.com
输出显示:UID: 12345
移动到Archive文件夹
./scripts/email.js move 12345 Archive
移动到自定义文件夹
./scripts/email.js move 67890 Projects/Work
错误处理:
- - 如果文件夹不存在,显示可用文件夹列表
- 在尝试移动前验证UID是否存在
帮助
bash
./scripts/email.js help
显示包含所有命令和示例的完整使用指南。
🎯 使用场景
每日邮件分类
bash
检查未读邮件
./scripts/email.js search --unseen --limit 10
将新闻通讯移动到文件夹
./scripts/email.js search --from newsletter@site.com --limit 1
./scripts/email.js move Newsletters
查找特定邮件
bash
按发件人和主题搜索
./scripts/email.js search --from client@example.com --subject proposal
按日期搜索
./scripts/email.js search --since Jan 20, 2026 --subject meeting notes
归档旧邮件
bash
查找旧的已读邮件
./scripts/email.js search --before Dec 1, 2025 --seen --limit 50
逐一移动到Archive(使用输出中的UID)
./scripts/email.js move Archive
检查附件
bash
读取最近邮件并查看附件信息
./scripts/email.js read 10
搜索输出自动显示:
- 附件数量
- 每个附件的文件名、类型和大小
🔒 安全性
- - 凭据从不记录或存储在文件中
- 所有连接使用TLS/SSL加密
- 推荐使用应用密码而非账户密码
- 除IMAP/SMTP连接外,无数据离开您的机器
⚙️ 配置
默认配置针对Zoho Mail EU进行了优化。
要使用其他提供商,编辑scripts/email.js:
javascript
// SMTP配置
const smtpConfig = {
host: smtp.your-provider.com,
port: 465, // 或587用于TLS
secure: true, // SSL为true(465),TLS为false(587)
auth: {
user: EMAIL_USER,
pass: EMAIL_PASS
}
};
// IMAP配置
const imapConfig = {
imap: {
user: EMAIL_USER,
password: EMAIL_PASS,
host: imap.your-provider.com,
port: 993,
tls: true,
authTimeout: 20000
}
};
🚀 性能说明
- - 正文搜索(--body)在大型邮箱中可能较慢 - 谨慎使用
- 主题/发件人搜索速度快 - 使用IMAP服务器端筛选
- 日期筛选效率高
- 使用--limit限制结果以获得更快响应
🐛 故障排除
认证失败
- - 验证EMAILUSER和EMAILPASS是否正确设置
- 使用应用密码,而非账户密码
- 检查提供商设置(两步验证、安全性较低的应用等)
文件夹未找到
-