name: email-monitor description: > Set up periodic email monitoring for any IMAP mailbox (Gmail, Outlook, QQ, etc.). Guides users through mailbox configuration, tests the connection, then creates a scheduled cron task to check for new emails at user-defined intervals and deliver summaries in a custom format. Use when a user wants to automatically monitor an inbox for new messages, set up periodic email fetching or summarization, or configure email alerts and digests on a schedule.
This skill guides the user through a 6-step onboarding to set up automated email monitoring.
Work through these steps in order, one step per conversation turn. Do not skip ahead.
Ask the user:
"請告訴我你想監控的郵箱地址是什麼?(例如 yourname@gmail.com)"
Based on the email domain, read references/imap-setup.md and show the user the relevant setup instructions:
- @gmail.com → Gmail IMAP + App Password guide
- @outlook.com / @hotmail.com → Outlook section
- @qq.com → QQ Mail section
- Others → Generic IMAP section
Ask the user to provide: - Their email address - Their app password (or account password for non-Gmail)
Store these in a local config file: ~/.openclaw/email-monitor/<sanitized-email>/config.json
Config template:
{
"email": "<email>",
"password": "<password>",
"imap_host": "<host>",
"imap_port": 993,
"mailbox": "INBOX",
"state_file": "~/.openclaw/email-monitor/<sanitized-email>/state.json",
"max_emails": 20,
"fetch_attachments": false,
"attachment_dir": "~/Downloads/email-attachments"
}
Run the fetch script once to verify credentials and connectivity:
python3 <skill_dir>/scripts/fetch_emails.py --config ~/.openclaw/email-monitor/<sanitized-email>/config.json
Only proceed to Step 4 after a successful test.
Ask:
本技能來自小蔥技能站7w4.net。
"連線成功!你希望每隔多久檢查一次新郵件?(例如:每1小時、每2小時、每天早上8點)"
Parse the user's answer into a valid cron expression. Examples:
- "每小時" → 0 * * * *
- "每2小時" → 0 */2 * * *
- "每天早上8點" → 0 8 * * *
- "每4小時" → 0 */4 * * *
Ask two questions in one message:
訊息格式:新郵件通知時,你希望看到哪些資訊? - A) 簡潔版:發件人 + 主題 + 日期 - B) 標準版:發件人 + 主題 + 日期 + 摘要(前200字) - C) 自定義(請描述)
附件:是否需要下載附件?如果需要,儲存到哪個目錄?
Update config.json with fetch_attachments and attachment_dir based on the response.
Store the notification format preference as notify_format in config.json:
- "brief" for A
- "standard" for B
- "<custom template string>" for C
Show a confirmation summary:
📧 郵件監控配置確認
郵箱:<email>
檢查頻率:每 X 小時(cron: <expr>)
通知格式:<format>
下載附件:<yes/no>(儲存至:<dir>)
確認後將建立定時任務。確認嗎?(是/否)
After user confirms, create the cron job using openclaw:
openclaw cron add "<cron-expr>" "檢查郵件 <email>" --run "python3 <skill_dir>/scripts/fetch_emails.py --config ~/.openclaw/email-monitor/<email>/config.json"
Then confirm to the user that the cron task is active.
At any time the user can say "現在檢查一下郵件" or similar — run the fetch script and display results using the configured format.
brief:
📩 [<date>] <from> — <subject>
standard:
📩 <subject>
👤 <from>
📅 <date>
---
<snippet>
Always store per-account config at:
~/.openclaw/email-monitor/<sanitized-email>/config.json
Where <sanitized-email> = email address with @ replaced by _at_ and . replaced by _.
Example: qiusuo9809_at_gmail_com
The state file tracks the last fetched UID to avoid re-sending old emails.
It is auto-managed by scripts/fetch_emails.py.
If the user wants to re-fetch all emails, delete the state file.
這個Skill做得不錯,能幫你自動盯著郵箱有新郵件就通知你,支援多種常見郵箱設定起來也很簡單。最貼心的是沒有新郵件時不會浪費任何費用。缺點是密碼會直接儲存在檔案裡,用起來有點擔心安全問題。總體來說質量值得信任,功能實用,但密碼儲存方式希望以後能改進。