163 Email Monitor
Key Insight: Coremail ID Command
163/126/yeah.net use Coremail which requires an IMAP ID command before any mailbox operation, otherwise returns "Unsafe Login" even with valid credentials.
Setup
Prerequisites
Credentials in ~/.openclaw/email-monitor/.env:
CODEBLOCK0
The EMAIL_PASSWORD is the 授权码 (authorization code), not the login password. Users obtain it from: 163 Mail → Settings → POP3/SMTP/IMAP → Enable IMAP → Get authorization code.
Server Reference
| Provider | IMAP Server | SMTP Server |
|---|
| 163.com | imap.163.com:993 | smtp.163.com:465 |
| 126.com |
imap.126.com:993 | smtp.126.com:465 |
| yeah.net | imap.yeah.net:993 | smtp.yeah.net:465 |
Usage
All operations use scripts/mail_client.py:
CODEBLOCK1
Pass --env /path/to/.env to override default config location.
Troubleshooting
| Error | Cause | Fix |
|---|
| INLINECODE4 | Missing ID command | Use this skill's script (handles automatically) |
| INLINECODE5 |
Wrong auth code | Regenerate 授权码 in 163 web settings |
|
LOGIN failed | IMAP not enabled | Enable IMAP in 163 Mail → Settings |
163 邮箱监控
核心洞察:Coremail ID 命令
163/126/yeah.net 使用 Coremail 系统,在任何邮箱操作前必须先发送 IMAP ID 命令,否则即使凭据有效也会返回不安全登录错误。
配置
前置条件
在 ~/.openclaw/email-monitor/.env 中配置凭据:
IMAP_SERVER=imap.163.com
IMAP_PORT=993
SMTP_SERVER=smtp.163.com
SMTP_PORT=465
EMAIL_ADDRESS=your@163.com
EMAILPASSWORD=yourauth_code
EMAIL_PASSWORD 是授权码,而非登录密码。用户获取方式:163 邮箱 → 设置 → POP3/SMTP/IMAP → 开启 IMAP → 获取授权码。
服务器参考
| 服务商 | IMAP 服务器 | SMTP 服务器 |
|---|
| 163.com | imap.163.com:993 | smtp.163.com:465 |
| 126.com |
imap.126.com:993 | smtp.126.com:465 |
| yeah.net | imap.yeah.net:993 | smtp.yeah.net:465 |
使用说明
所有操作均使用 scripts/mail_client.py:
bash
读取未读邮件
python3 scripts/mail_client.py read --unread
读取最新 N 封邮件
python3 scripts/mail_client.py read --latest 10
按关键词搜索邮件
python3 scripts/mail_client.py search amazon
按发件人搜索
python3 scripts/mail_client.py search --from no-reply@amazon.com
按日期范围搜索
python3 scripts/mail_client.py search --since 2026-03-01 --before 2026-03-23
发送邮件
python3 scripts/mail_client.py send --to recipient@example.com --subject Hello --body Content here
发送带附件的邮件
python3 scripts/mail_client.py send --to recipient@example.com --subject Report --body See attached --attach /path/to/file.pdf
添加 --env /path/to/.env 参数可覆盖默认配置路径。
故障排除
| 错误信息 | 原因 | 解决方法 |
|---|
| Unsafe Login | 缺少 ID 命令 | 使用本技能的脚本(自动处理) |
| AUTHENTICATIONFAILED |
授权码错误 | 在 163 网页设置中重新生成授权码 |
| LOGIN failed | IMAP 未开启 | 在 163 邮箱 → 设置中开启 IMAP |