{"id":"010e63ab-3b11-4eb1-a195-fa2c317d8c5f","entityType":"agent","slug":"clawhub-tobewin-emailbox","name":"Emailbox","canonicalUrl":"https://www.xpersona.co/agent/clawhub-tobewin-emailbox","canonicalPath":"/agent/clawhub-tobewin-emailbox","generatedAt":"2026-10-11T14:14:51.692Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:20:47.473Z","emptyReason":null},"description":"职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachmen...","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s174rz3f0862tcfw7pzfh5w8kn83hv2z:emailbox","sourceUrl":"https://clawhub.ai/tobewin/emailbox","homepage":"https://clawhub.ai/tobewin/skills/emailbox","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/tobewin/emailbox","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/tobewin/skills/emailbox","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":61,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Emailbox technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:20:47.473Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:20:47.473Z","emptyReason":null},"stars":null,"forks":null,"downloads":1078,"packageName":null,"latestVersion":"1.2.1","tractionLabel":"1.1K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:20:47.416Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T11:20:47.473Z","lastCrawledAt":"2026-10-11T11:20:47.416Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T11:20:47.416Z","lastVerifiedAt":null,"highlights":[{"version":"1.2.1","createdAt":"2026-07-03T09:22:02.027Z","changelog":"v1.2.1: 修复 SkillSpector 全部 8 个 finding（零功能改动，仅加警告/guardrails） 【Lp3】加 metadata.openclaw permissions 声明 【Missing User Warnings ×6】顶部加数据外发/凭据安全提醒; Quick Start 加 env 泄露提醒; Provider Guide 加授权码安全提醒; Privacy 节补充 env 暴露说明; integrations.md 顶部总提醒 + 发票/合同/简历工作流各加 guardrails 【Session Persistence】credentials 文件已标注 chmod 600 且多处提醒不存明文","fileCount":10,"zipByteSize":30371},{"version":"1.2.0","createdAt":"2026-04-18T16:11:42.177Z","changelog":"v1.2.0: Security hardening - removed auto crontab modification, removed plaintext credential storage, added forward support, body search, bilingual output, manual-only scheduler setup. All security scan concerns addressed.","fileCount":10,"zipByteSize":29107},{"version":"1.1.0","createdAt":"2026-04-18T16:04:34.517Z","changelog":"v1.1.0: Fixed critical bugs (broken scheduler, missing forward feature), added forwarding support, body search, bilingual output, international provider docs, documented --receipt/--importance/--folder options, security review clean (stdlib only)","fileCount":9,"zipByteSize":27422},{"version":"1.0.0","createdAt":"2026-04-18T15:49:56.384Z","changelog":"Initial release: IMAP/SMTP email client supporting 12+ providers, send/receive/search/schedule emails, HTML templates, attachments, document integration","fileCount":9,"zipByteSize":26219}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s174rz3f0862tcfw7pzfh5w8kn83hv2z:emailbox","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s174rz3f0862tcfw7pzfh5w8kn83hv2z:emailbox` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/tobewin/emailbox before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T14:14:51.689Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-tobewin-emailbox/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T11:20:47.473Z","emptyReason":null},"readme":"Skill: Emailbox\n\nOwner: tobewin\n\nSummary: 职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachmen...\n\nTags: 163:1.2.0, attachment:1.2.0, china:1.2.0, email:1.2.0, emailbox:1.0.0, forward:1.2.0, gmail:1.2.0, html-template:1.2.0, imap:1.2.0, international:1.2.0, latest:1.2.1, outlook:1.2.0, qq:1.2.0, schedule:1.2.0, smtp:1.2.0\n\nVersion history:\n\nv1.2.1 | 2026-07-03T09:22:02.027Z | user\n\nv1.2.1: 修复 SkillSpector 全部 8 个 finding（零功能改动，仅加警告/guardrails）\n\n【Lp3】加 metadata.openclaw permissions 声明\n【Missing User Warnings ×6】顶部加数据外发/凭据安全提醒; Quick Start 加 env 泄露提醒; Provider Guide 加授权码安全提醒; Privacy 节补充 env 暴露说明; integrations.md 顶部总提醒 + 发票/合同/简历工作流各加 guardrails\n【Session Persistence】credentials 文件已标注 chmod 600 且多处提醒不存明文\n\nv1.2.0 | 2026-04-18T16:11:42.177Z | user\n\nv1.2.0: Security hardening - removed auto crontab modification, removed plaintext credential storage, added forward support, body search, bilingual output, manual-only scheduler setup. All security scan concerns addressed.\n\nv1.1.0 | 2026-04-18T16:04:34.517Z | user\n\nv1.1.0: Fixed critical bugs (broken scheduler, missing forward feature), added forwarding support, body search, bilingual output, international provider docs, documented --receipt/--importance/--folder options, security review clean (stdlib only)\n\nv1.0.0 | 2026-04-18T15:49:56.384Z | user\n\nInitial release: IMAP/SMTP email client supporting 12+ providers, send/receive/search/schedule emails, HTML templates, attachments, document integration\n\nArchive index:\n\nArchive v1.2.1: 10 files, 30371 bytes\n\nFiles: LICENSE.txt (1077b), references/integrations.md (7976b), references/providers.md (7510b), references/templates.md (15167b), scripts/receive_mail.py (18532b), scripts/schedule_mail.py (16796b), scripts/send_mail.py (14904b), skill-card.md (3358b), SKILL.md (14782b), _meta.json (127b)\n\nFile v1.2.1:SKILL.md\n\n---\nname: emailbox\ndescription: 职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachments, forwarding, data integration. 邮件收发、搜索、定时发送、附件、HTML模板、转发、文档数据联动。\nversion: 1.2.0\nlicense: MIT-0\nmetadata: {\"openclaw\": {\"emoji\": \"📬\", \"requires\": {\"bins\": [\"python3\"], \"env\": [\"EMAIL_ADDRESS\", \"EMAIL_AUTH\"]}, \"primaryEnv\": \"EMAIL_AUTH\"}}\n---\n\n# Emailbox - Professional Email Client & Data Integration\n\nIMAP/SMTP-based email toolkit supporting 12+ providers. Send, receive, search, forward, schedule emails with HTML templates, attachments, and document data integration.\n\n> ⚠️ **数据外发提醒**：邮件内容（收件人、主题、正文、附件）通过 IMAP/SMTP 协议直接发送至邮件服务商服务器。涉及发票、合同、简历等敏感数据时，请在发送前确认收件人正确。\n>\n> ⚠️ **凭据安全**：邮箱授权码等同于密码。环境变量可能通过 shell history、进程列表、CI 日志泄露。每次使用完后建议 `unset EMAIL_AUTH`。\n\n## Features\n\n- **Send**: Plain text, HTML, attachments, CC/BCC, reply, forward\n- **Receive**: List inbox, read emails, download attachments\n- **Search**: By keyword (subject/from/body), date range, sender\n- **Forward**: Fetch original email, forward to new recipients\n- **Schedule**: Send emails at a future time\n- **Templates**: 7 professional HTML email templates\n- **Integration**: Excel/OCR/PDF data → format → email\n- **Providers**: QQ, 163, 126, Sina, Outlook, Gmail, Yahoo, iCloud, Tencent Exmail, Ali Mail, Huawei, 139\n\n## Trigger\n\n- \"Send email to...\" / \"发邮件给...\"\n- \"Check inbox\" / \"查看收件箱\"\n- \"Reply to this email\" / \"回复这封邮件\"\n- \"Forward this email\" / \"转发这封邮件\"\n- \"Search emails from...\" / \"搜索...的邮件\"\n- \"Schedule email for...\" / \"定时发送...\"\n- \"Process data and email...\" / \"整理数据后发邮件\"\n- \"Attach this file...\" / \"添加附件...\"\n\n---\n\n## Step 0: Setup\n\n### Quick Start (Single Account)\n\n```bash\n# Set 2 environment variables and you're ready\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n> ⚠️ `export` 设置的变量在当前 shell 及所有子进程可见（包括 ps 命令、CI 日志、崩溃报告）。\n> 用完建议 `unset EMAIL_AUTH`，或使用 `.env` 文件 + `source` 替代一次性 export。\n\n### Multi-Account Setup\n\n```bash\n# QQ Mail\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_auth_code\"\n\n# 163 Mail\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### Provider Auth Guide\n\nHow to get authorization codes for each provider → `references/providers.md`\n\n> ⚠️ 授权码等同于邮箱密码，拥有它可以收发你的所有邮件。不要分享给他人，不要在公共终端设置。\n\n### Persistent Config\n\n**IMPORTANT: Never store email credentials in plaintext files.** Use your system's secure credential manager or session-only environment variables.\n\n```bash\n# Option A: Session-only (recommended for security)\n# Set environment variables in your current shell session only.\n# Credentials will NOT persist after the session ends.\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_auth_code\"\n\n# Option B: Keychain / secret manager\n# macOS: Use `security add-internet-password`\n# Linux: Use `secret-tool store` (libsecret)\n# Windows: Use Windows Credential Manager\n\n# Option C: Restricted file (if persistent config is required)\n# Create a file with restricted permissions that only you can read:\nmkdir -p ~/.emailbox && touch ~/.emailbox/credentials\nchmod 600 ~/.emailbox/credentials\n# Then add your credentials:\n# EMAIL_ADDRESS=your@qq.com\n# EMAIL_AUTH=your_auth_code\n# \n# Before running emailbox commands:\n# source ~/.emailbox/credentials\n```\n\n---\n\n## Step 1: Send Email\n\n### Plain Text\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"recipient@example.com\" \\\n  --subject \"Project Update\" \\\n  --body \"Hi, here is the project update...\" \\\n  --provider qq\n```\n\n### Multiple Recipients + CC/BCC\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com,team@company.com\" \\\n  --cc \"hr@company.com\" \\\n  --bcc \"archive@company.com\" \\\n  --subject \"Weekly Report\" \\\n  --body \"Please find the weekly report attached.\" \\\n  --provider 163\n```\n\n### HTML Email (Use Templates)\n\nChoose a template from `references/templates.md`, fill in variables, save as HTML, then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"client@company.com\" \\\n  --subject \"Sales Report - 2026W16\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --provider outlook\n```\n\n### With Attachments\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"finance@company.com\" \\\n  --subject \"Invoice - FP20260418001\" \\\n  --body \"Please find the invoice attached.\" \\\n  --attach \"/path/to/invoice.jpg\" \"/path/to/detail.xlsx\" \\\n  --provider qq\n```\n\n### High Priority + Read Receipt\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"manager@company.com\" \\\n  --subject \"URGENT: Contract Review\" \\\n  --body \"Please review the attached contract ASAP.\" \\\n  --importance high \\\n  --receipt \\\n  --provider outlook\n```\n\n### Reply to Email\n\nFirst get the Message-ID from reading an email (Step 3), then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"sender@example.com\" \\\n  --subject \"Re: Original Subject\" \\\n  --body \"Got it, confirmed.\" \\\n  --reply-to \"<msgid@example.com>\" \\\n  --provider qq\n```\n\n### Forward Email\n\nFirst get the original email metadata (Step 4), then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"colleague@company.com\" \\\n  --subject \"Fwd: Original Subject\" \\\n  --body \"Please see the forwarded message below.\" \\\n  --forward-from \"Original Sender <sender@example.com>\" \\\n  --forward-date \"Mon, 18 Apr 2026 10:30:00 +0800\" \\\n  --forward-subject \"Original Subject\" \\\n  --forward-to \"me@company.com\" \\\n  --provider qq\n```\n\n---\n\n## Step 2: Receive Email\n\n### List Inbox (Recent Emails)\n\n```bash\npython3 scripts/receive_mail.py --list\npython3 scripts/receive_mail.py --list --count 20\npython3 scripts/receive_mail.py --list --provider gmail\npython3 scripts/receive_mail.py --list --folder \"Sent Items\"\n```\n\n### Read Email Content\n\n```bash\npython3 scripts/receive_mail.py --read 123 --provider qq\n```\n\n### Download Attachments\n\n```bash\npython3 scripts/receive_mail.py --read 123 --download-attachment 123 \\\n  --save-dir \"${OPENCLAW_WORKSPACE:-$PWD}/downloads\"\n```\n\n---\n\n## Step 3: Search Email\n\n```bash\n# Search by keyword (searches subject, from, AND body)\npython3 scripts/receive_mail.py --search \"contract\" --provider qq\n\n# Search by sender\npython3 scripts/receive_mail.py --search \"\" --from-filter \"zhangsan@company.com\"\n\n# Search by date range\npython3 scripts/receive_mail.py --search \"report\" --since \"2026-04-01\"\n\n# Combined search\npython3 scripts/receive_mail.py --search \"invoice\" --from-filter \"finance@company.com\" --since \"2026-04-01\" --count 5\n```\n\n### IMAP Folders\n\nAccess folders beyond INBOX:\n```bash\npython3 scripts/receive_mail.py --list --folder \"Sent Items\"\npython3 scripts/receive_mail.py --list --folder \"Drafts\"\npython3 scripts/receive_mail.py --list --folder \"Trash\"\n```\n\nCommon folder names:\n- Gmail: `[Gmail]/Sent Mail`, `[Gmail]/Drafts`, `[Gmail]/Spam`\n- QQ Mail: `Sent Messages`, `Drafts`, `Deleted Messages`\n- 163 Mail: `Sent`, `Drafts`, `Deleted`\n- Outlook: `SentItems`, `Drafts`, `Deleted`\n\n---\n\n## Step 4: Forward Email\n\n```bash\n# Step 1: Get original email metadata\npython3 scripts/receive_mail.py --forward 123 --provider qq\n\n# Output includes FORWARD_META with From/To/CC/Date/Subject/Message-ID\n\n# Step 2: Forward using the metadata\npython3 scripts/send_mail.py \\\n  --to \"colleague@company.com\" \\\n  --subject \"Fwd: Original Subject\" \\\n  --body \"FYI, please see below.\" \\\n  --forward-from \"Original Sender <sender@example.com>\" \\\n  --forward-date \"Mon, 18 Apr 2026 10:30:00 +0800\" \\\n  --forward-subject \"Original Subject\" \\\n  --forward-to \"me@company.com\" \\\n  --provider qq\n```\n\n---\n\n## Step 5: Document Data Integration\n\nCombine other Skills' output with email sending.\n\nDetailed workflows → `references/integrations.md`\n\n### Common Patterns\n\n```\n1. Excel → Email: Read data → HTML table → send\n2. OCR → Email: Recognize invoice → extract key info → send\n3. PDF → Email: Process PDF → summary + attachment → send\n4. Data Analysis → Email: Analyze data → conclusions → send\n5. Scheduled Report: Generate content → schedule → send\n```\n\n### Excel Data → Email Example\n\n```bash\n# Step 1: Read and format data (use excel-studio or python3)\n# Step 2: Save HTML content using a template from references/templates.md\n# Step 3: Send\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com\" \\\n  --subject \"Sales Report $(date +%Y%m%d)\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --attach \"/path/to/report.xlsx\" \\\n  --provider qq\n```\n\n### Related Skills\n\n| Skill | Integration | Scenario |\n|-------|------------|----------|\n| china-doc-ocr | OCR → email content | Invoice/contract recognition then email |\n| excel-studio | Excel → table email | Data reports, financial statements |\n| pdf-studio | PDF → email attachment | PDF report sending |\n| data-analyzer | Analysis → email conclusions | Data insight notifications |\n\n---\n\n## Step 6: Schedule Email\n\n### Send at Specific Time\n\n```bash\npython3 scripts/schedule_mail.py \\\n  --schedule --at \"2026-04-19 09:00\" \\\n  --to \"boss@company.com\" \\\n  --subject \"Daily Report - 2026-04-19\" \\\n  --body \"Today's work summary...\" \\\n  --provider qq\n```\n\n### Send in N Minutes\n\n```bash\npython3 scripts/schedule_mail.py \\\n  --schedule --in 30 \\\n  --to \"client@example.com\" \\\n  --subject \"Follow up\" \\\n  --body \"Following up on our meeting...\" \\\n  --provider 163\n```\n\n### Manage Scheduled Emails\n\n```bash\n# View scheduled emails\npython3 scripts/schedule_mail.py --list-scheduled\n\n# Cancel a scheduled email\npython3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n# Manually process due emails\npython3 scripts/schedule_mail.py --process-queue\n```\n\n### Auto-Processing (Manual Setup Only)\n\n**⚠️ The schedule script will NEVER modify your crontab automatically.** You must manually confirm any crontab changes.\n\n```bash\n# Step 1: Check your current crontab first\ncrontab -l > ~/crontab_backup.txt\n\n# Step 2: Add the emailbox processor manually (review before adding!)\n# Add this line to your crontab ONLY if you want auto-processing:\n# * * * * * python3 /path/to/emailbox/scripts/schedule_mail.py --process-queue\n\n# Step 3: To remove later, edit your crontab and remove the line\n```\n\n---\n\n## Step 7: HTML Email Templates\n\n7 professional templates available → `references/templates.md`\n\n| Template | Use Case |\n|----------|----------|\n| Business Report | Data reports, financial summaries |\n| Meeting Invitation | Meetings, events, interviews |\n| Notification / Announcement | Company announcements, system alerts |\n| Thank You Letter | Appreciation, follow-ups |\n| Weekly/Daily Report | Work progress updates |\n| Invoice Notification | Invoice/receipt processing |\n| Formal Letter | Official correspondence |\n\n---\n\n## Provider Configuration\n\n12+ providers with IMAP/SMTP config and auth code guides → `references/providers.md`\n\n| Provider | IMAP | SMTP | Port | Auth | China |\n|----------|------|------|------|------|-------|\n| QQ Mail | imap.qq.com | smtp.qq.com | 465 | Authorization code | Yes |\n| 163 Mail | imap.163.com | smtp.163.com | 465 | Client password | Yes |\n| 126 Mail | imap.126.com | smtp.126.com | 465 | Client password | Yes |\n| Sina | imap.sina.com | smtp.sina.com | 465 | Enable IMAP | Yes |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | App password | Yes |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | App password | VPN |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | App password | VPN |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | App password | VPN |\n| Tencent Exmail | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | Enable IMAP | Yes |\n| Ali Mail | imap.mxhichina.com | smtp.mxhichina.com | 465 | Enable IMAP | Yes |\n| Huawei | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | App password | Yes |\n| 139 Mail | imap.mail.139.com | smtp.mail.139.com | 465 | Enable IMAP | Yes |\n\n---\n\n## Error Handling\n\n```\nError                              → Solution\n──────────────────────────────────────────────────────────\nSMTP auth failed                   → Check authorization code, see providers.md\nIMAP connection failed             → Verify IMAP enabled, check network\nConnection timeout                 → Gmail/Yahoo/iCloud need VPN in China\nSMTP auth code error (QQ/163)     → Use authorization code, NOT login password\nSending rate limit                 → QQ: 1/min, 500/day; 163: 200/day; Gmail: 500/day\nAttachment too large               → QQ: 50MB; Gmail: 25MB; Outlook: 20MB\nIMAP not enabled                   → Enable in email settings, see providers.md\n163 requires phone verification    → Verify via SMS, wait 5-10 minutes\n```\n\n---\n\n## Privacy & Security\n\n- Direct IMAP/SMTP connection to email servers, no third-party data transfer\n- **Credentials should be stored in environment variables only, NOT in plaintext files**\n- ⚠️ 环境变量中的凭据可能通过 shell history、进程列表（`ps aux`）、CI 日志、崩溃报告泄露\n- 用完授权码后建议 `unset EMAIL_AUTH` 清除当前 shell 的凭据\n- Use provider-specific app passwords/authorization codes (NOT your login password)\n- Authorization codes are email-specific, cannot be used to log into webmail\n- Schedule queue stored in `~/.emailbox/queue/` — review and clean up regularly\n- **This skill will NEVER modify your crontab or system scheduler without your explicit manual action**\n- For maximum security, use a dedicated email account for automated sending\n\n## Notes\n\n- Requires IMAP/SMTP service enabled and authorization code configured\n- Gmail/Yahoo/iCloud require VPN in mainland China\n- QQ Mail limits: 500 emails/day, 1 email/minute\n- 163/126 Mail limits: 200 emails/day\n- Attachment size limits vary by provider (QQ: 50MB, Gmail: 25MB, Outlook: 20MB)\n- Scheduled sending uses a local queue in `~/.emailbox/queue/`; processing requires manual crontab setup\n- **Always use app passwords/authorization codes, never your real email login password**\n\nFile v1.2.1:_meta.json\n\n{\n  \"ownerId\": \"kn75z6gevjsyrznm7dg2ez6sen82h8sz\",\n  \"slug\": \"emailbox\",\n  \"version\": \"1.2.1\",\n  \"publishedAt\": 1783070522027\n}\n\nFile v1.2.1:references/integrations.md\n\n# 文档数据联动 Document Integration\n\n邮件与文档数据处理的一体化工作流。结合其他 Skills 的能力，实现\"数据处理 → 格式化 → 邮件发送\"的自动化。\n\n> ⚠️ 以下工作流涉及发票、合同、简历等敏感数据的邮件发送。\n> 执行前务必确认收件人地址正确，且用户确实授权发送这些数据。\n\n---\n\n## 场景总览\n\n| 场景 | 数据来源 | 邮件输出 | 关联 Skill |\n|------|----------|----------|-----------|\n| Excel 报表发送 | .xlsx/.csv 数据 | HTML 表格 + 附件 | excel-studio |\n| 发票识别+邮件 | 图片/PDF 发票 | 结构化摘要 + 附件 | china-doc-ocr |\n| 合同审核+邮件 | 合同 PDF | 审核要点 + 附件 | china-doc-ocr, china-legal-analysis |\n| PDF 报告发送 | PDF 文件 | 摘要 + 附件 | pdf-studio |\n| 简历解析+邮件 | 简历 PDF/Word | 候选人摘要 + 附件 | china-doc-ocr |\n| 数据分析+邮件 | 原始数据 | 分析结论 + 图表 | data-analyzer |\n\n---\n\n## 工作流模板\n\n### 流程 1：Excel 数据 → 格式化邮件\n\n```\n用户请求：\"把这个 Excel 的销售数据做成表格发邮件给老板\"\n↓\nStep 1: 读取 Excel 文件\n  → 使用 excel-studio 读取数据\n  → 或使用 python3 + openpyxl 直接读取\n↓\nStep 2: 数据处理与格式化\n  → 提取关键指标（总计、变化、排名等）\n  → 生成 HTML 表格（使用 templates.md 中商务报告模板）\n  → 生成纯文本摘要（作为 fallback）\n↓\nStep 3: 生成邮件内容并保存\n  → 将 HTML 保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.html\n  → 将纯文本保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.txt\n↓\nStep 4: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to boss@company.com \\\n    --subject \"销售数据周报 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/sales_data.xlsx \\\n    --provider qq\n```\n\n### 流程 2：OCR 识别 → 邮件通知\n\n> ⚠️ 本流程将发送发票金额、号码、购方/销方信息等财务数据。发送前确认收件人是正确的财务负责人邮箱。\n\n```\n用户请求：\"识别这张发票，把结果发邮件给财务\"\n↓\nStep 1: OCR 识别\n  → 使用 china-doc-ocr 识别发票图片/PDF\n  → 提取关键字段：发票号码、金额、日期、购方/销方信息\n↓\nStep 2: 格式化邮件内容\n  → 使用 templates.md 中的发票通知模板\n  → 填入识别出的字段数据\n  → 生成纯文本摘要\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to finance@company.com \\\n    --subject \"发票处理 - ${invoice_number}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/invoice.jpg \\\n    --provider 163\n```\n\n### 流程 3：合同审核 → 邮件汇报\n\n> ⚠️ 合同内容、法务分析、风险点属于高度敏感信息。发送前向用户确认收件人（法务邮箱）无误，且用户清楚邮件包含合同原文及审核意见。\n\n```\n用户请求：\"审核这份合同后把要点发邮件给法务\"\n↓\nStep 1: 识别合同\n  → 使用 china-doc-ocr 识别合同文本\n↓\nStep 2: 法律分析\n  → 使用 china-legal-analysis 分析合同条款\n  → 提取风险点和审核意见\n↓\nStep 3: 格式化并发送\n  python3 scripts/send_mail.py \\\n    --to legal@company.com \\\n    --subject \"合同审核报告 - ${contract_name}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/contract.pdf \\\n    --importance high \\\n    --provider qq\n```\n\n### 流程 4：简历解析 → 转发 HR\n\n> ⚠️ 简历包含姓名、学历、工作经历等个人敏感信息（PII）。发送前确认用户有权转发该简历，且收件人（HR 邮箱）正确。\n\n```\n用户请求：\"解析这份简历然后转发给HR\"\n↓\nStep 1: 识别简历\n  → 使用 china-doc-ocr 识别简历 PDF/图片\n↓\nStep 2: 结构化提取\n  → 提取姓名、学历、工作经验、技能等\n  → 生成候选人摘要卡片\n↓\nStep 3: 转发邮件\n  python3 scripts/send_mail.py \\\n    --to hr@company.com \\\n    --subject \"候选人推荐 - ${candidate_name} - ${position}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/resume.pdf\n```\n\n### 流程 5：数据分析 → 邮件报告\n\n```\n用户请求：\"分析这份数据后发邮件给团队\"\n↓\nStep 1: 读取和数据\n  → 使用 data-analyzer 或 python3 分析 CSV/Excel\n↓\nStep 2: 生成分析报告\n  → 关键指标、趋势、异常值\n  → 生成 HTML 报告格式\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to \"team1@company.com,team2@company.com\" \\\n    --subject \"数据分析报告 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/data.xlsx\n```\n\n### 流程 6：定时日报/周报\n\n```\n用户请求：\"每天早上9点自动发日报给老板\"\n↓\nStep 1: 收集日报内容\n  → 用户或 AI 生成日报内容\n  → 保存为 HTML 文件\n↓\nStep 2: 设置定时发送\n  python3 scripts/schedule_mail.py \\\n    --schedule \\\n    --at \"2026-04-19 09:00\" \\\n    --to boss@company.com \\\n    --subject \"工作日报 - $(date +%Y-%m-%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --provider qq\n↓\nStep 3: 管理定时任务\n  # 查看已安排的定时邮件\n  python3 scripts/schedule_mail.py --list-scheduled\n\n  # 取消定时邮件\n  python3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n  # 手动处理到期队列\n  python3 scripts/schedule_mail.py --process-queue\n```\n\n---\n\n## 数据格式转换速查\n\n### 从 Excel 生成 HTML 表格\n\n```python\nimport json\n\n# 假设从 Excel 读取的数据格式\ndata = [\n    [\"指标\", \"本周\", \"上周\", \"变化\"],\n    [\"营收\", \"¥128万\", \"¥115万\", \"↑11.3%\"],\n    [\"用户数\", \"12,345\", \"11,890\", \"↑3.8%\"],\n    [\"转化率\", \"3.2%\", \"2.9%\", \"↑0.3pp\"],\n]\n\n# 生成 HTML 表格行\ntable_rows = \"\"\nfor i, row in enumerate(data):\n    if i == 0:\n        continue  # 跳过表头（模板已有）\n    color = \"#27ae60\" if \"↑\" in row[3] else \"#e74c3c\"\n    table_rows += f'<tr style=\"border-bottom:1px solid #eee;\">'\n    for j, cell in enumerate(row):\n        align = \"text-align:right\" if j > 0 else \"\"\n        font = \"font-weight:bold\" if j == 3 else \"\"\n        row_color = f'color:{color}' if j == 3 else \"\"\n        table_rows += f'<td style=\"padding:10px 16px;font-size:14px;{align};{font};{row_color};\">{cell}</td>'\n    table_rows += '</tr>\\n'\n```\n\n### 从 OCR 结果生成邮件内容\n\n```python\n# OCR 识别结果（从 china-doc-ocr 获取）\nocr_result = {\n    \"invoice_number\": \"12345678\",\n    \"amount\": \"¥5,280.00\",\n    \"date\": \"2026年4月18日\",\n    \"seller\": \"XX科技有限公司\",\n    \"buyer\": \"YY集团有限公司\",\n}\n\n# 生成摘要文本\nsummary = f\"\"\"发票识别结果：\n发票号码：{ocr_result['invoice_number']}\n开票日期：{ocr_result['date']}\n金额：{ocr_result['amount']}\n销售方：{ocr_result['seller']}\n购买方：{ocr_result['buyer']}\n\"\"\"\n```\n\n---\n\n## 与 Skills 联动清单\n\n| Skill | 联动方式 | 典型场景 |\n|-------|----------|----------|\n| china-doc-ocr | OCR 识别 → 邮件内容 | 发票、合同、证件识别后邮件发送 |\n| excel-studio | 读取 Excel → 表格邮件 | 数据报表、财务报告 |\n| pdf-studio | PDF 处理 → 邮件附件 | PDF 报告发送 |\n| data-analyzer | 数据分析 → 结论邮件 | 数据洞察通知 |\n| china-legal-analysis | 合同审核 → 邮件通知 | 合同风险点邮件通知 |\n| interview-pro | 面试反馈 → 邮件通知 | 候选人评估结果邮件 |\n\nFile v1.2.1:references/providers.md\n\n# 邮箱服务商配置 Email Provider Configuration\n\n## 12+ 服务商 IMAP/SMTP 配置\n\n| 服务商 | IMAP 服务器 | SMTP 服务器 | SMTP 端口 | SSL | 环境变量 |\n|--------|-------------|-------------|----------|-----|----------|\n| QQ 邮箱 | imap.qq.com | smtp.qq.com | 465 | SSL | EMAIL_QQ / EMAIL_QQ_AUTH |\n| 163 邮箱 | imap.163.com | smtp.163.com | 465 | SSL | EMAIL_163 / EMAIL_163_AUTH |\n| 126 邮箱 | imap.126.com | smtp.126.com | 465 | SSL | EMAIL_126 / EMAIL_126_AUTH |\n| 新浪邮箱 | imap.sina.com | smtp.sina.com | 465 | SSL | EMAIL_SINA / EMAIL_SINA_AUTH |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | STARTTLS | EMAIL_OUTLOOK / EMAIL_OUTLOOK_AUTH |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | STARTTLS | EMAIL_GMAIL / EMAIL_GMAIL_AUTH |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | STARTTLS | EMAIL_YAHOO / EMAIL_YAHOO_AUTH |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | STARTTLS | EMAIL_ICLOUD / EMAIL_ICLOUD_AUTH |\n| 腾讯企业邮箱 | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | SSL | EMAIL_EXMAIL / EMAIL_EXMAIL_AUTH |\n| 阿里企业邮箱 | imap.mxhichina.com | smtp.mxhichina.com | 465 | SSL | EMAIL_ALIMAIL / EMAIL_ALIMAIL_AUTH |\n| 华为邮箱 | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | SSL | EMAIL_HUAWEI / EMAIL_HUAWEI_AUTH |\n| 139 邮箱 | imap.mail.139.com | smtp.mail.139.com | 465 | SSL | EMAIL_139 / EMAIL_139_AUTH |\n\n---\n\n## 环境变量配置\n\n### 单账号模式（推荐新手）\n\n最简配置，只需 2 个环境变量：\n\n```bash\nexport EMAIL_ADDRESS=\"your@email.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### 多账号模式（支持多个邮箱）\n\n每个邮箱单独配置：\n\n```bash\n# QQ 邮箱\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_authorization_code\"\n\n# 163 邮箱\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Outlook\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"outlook_app_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### 优先级规则\n\n1. 命令行指定 `--from-addr` 和 `--provider` 最高优先\n2. 对应服务商的环境变量（如 `EMAIL_QQ` / `EMAIL_QQ_AUTH`）\n3. 通用环境变量 `EMAIL_ADDRESS` / `EMAIL_AUTH`\n\n---\n\n## Authorization Code Setup / 授权码获取教程\n\n### QQ Mail / QQ 邮箱\n\n1. Log in to QQ Mail (mail.qq.com) → Settings (设置) → Account (账号)\n2. Find \"POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV Service\"\n3. Enable IMAP/SMTP service\n4. Click \"Generate Authorization Code\" (生成授权码)\n5. Follow prompts to send SMS verification from your phone\n6. Receive 16-character authorization code (no spaces)\n\n```bash\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"abcdefghijklmnop\"\n```\n\n**Note:** QQ Mail authorization code is 16 letters, NOT your QQ password.\n\n### 163 Mail / 163 邮箱\n\n1. Log in to 163 Mail (mail.163.com) → Settings (设置) → POP3/SMTP/IMAP\n2. Enable \"IMAP/SMTP Service\"\n3. Click \"Client Authorization Password\" (客户端授权密码)\n4. Verify via SMS, then set the authorization password\n\n```bash\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"your_client_password\"\n```\n\n**Note:** 163 Mail requires authorization password, NOT your login password.\n\n### 126 Mail / 126 邮箱\n\n1. Log in to 126 Mail (mail.126.com) → Settings → POP3/SMTP/IMAP\n2. Enable IMAP service\n3. Set client authorization password\n\n```bash\nexport EMAIL_126=\"your@126.com\"\nexport EMAIL_126_AUTH=\"your_client_password\"\n```\n\n### Sina Mail / 新浪邮箱\n\n1. Log in to Sina Mail (mail.sina.com) → Settings → Client Settings\n2. Enable IMAP/SMTP service\n3. 部分账号需要通过手机验证\n\n```bash\nexport EMAIL_SINA=\"your@sina.com\"\nexport EMAIL_SINA_AUTH=\"your_password\"\n```\n\n### Outlook / Hotmail\n\n1. Visit https://account.microsoft.com/security\n2. Advanced security options → App passwords\n3. Generate a new app password\n\n```bash\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"your_app_password\"\n```\n\n**Note:** If two-step verification is enabled, you MUST use an app password, not your login password. Microsoft is deprecating basic auth — OAuth2 Modern Auth may be required in the future.\n\n### Gmail\n\n1. Enable two-step verification: https://myaccount.google.com/security\n2. Create an app password: https://myaccount.google.com/apppasswords\n3. Select \"Mail\" and device, generate the 16-character password\n4. **Google removed \"Less Secure Apps\" access in 2022** — only App Passwords work now\n\n```bash\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"abcd efgh ijkl mnop\"\n```\n\n**Note:** Gmail app passwords may contain spaces; no need to remove them. Requires VPN in mainland China.\n\n### Yahoo Mail\n\n1. Log in to Yahoo → Account Security → Generate app password\n2. Yahoo no longer supports \"Less Secure Apps\" — app password is required\n\n```bash\nexport EMAIL_YAHOO=\"your@yahoo.com\"\nexport EMAIL_YAHOO_AUTH=\"your_app_password\"\n```\n\n**Note:** Requires VPN in mainland China.\n\n### iCloud Mail\n\n1. Apple ID → Account Settings → App-Specific Passwords\n2. Generate a password\n\n```bash\nexport EMAIL_ICLOUD=\"your@icloud.com\"\nexport EMAIL_ICLOUD_AUTH=\"your_app_specific_password\"\n```\n\n**Note:** Requires VPN in mainland China.\n\n### Tencent Exmail / 腾讯企业邮箱\n\n1. Log in to enterprise mail (exmail.qq.com) → Settings → Client Settings\n2. Confirm IMAP service is enabled\n3. Use enterprise email password or authorization code\n\n```bash\nexport EMAIL_EXMAIL=\"your@company.com\"\nexport EMAIL_EXMAIL_AUTH=\"your_password\"\n```\n\n### Ali Mail / 阿里企业邮箱\n\n1. Log in to Ali Mail (mail.mxhichina.com) → Settings → POP/IMAP Settings\n2. Enable IMAP service\n\n```bash\nexport EMAIL_ALIMAIL=\"your@company.com\"\nexport EMAIL_ALIMAIL_AUTH=\"your_password\"\n```\n\n### Huawei Mail / 华为邮箱\n\n1. Log in to Huawei Mail (mail.hicloud.com) → Settings → Account Security\n2. Generate app password\n\n```bash\nexport EMAIL_HUAWEI=\"your@hicloud.com\"\nexport EMAIL_HUAWEI_AUTH=\"your_app_password\"\n```\n\n### 139 Mail / 139 邮箱 (China Mobile)\n\n1. Log in to 139 Mail (mail.139.com) → Settings → Account\n2. Enable IMAP service\n\n```bash\nexport EMAIL_139=\"your@139.com\"\nexport EMAIL_139_AUTH=\"your_password\"\n```\n\n---\n\n## Common Issues / 常见问题\n\n### SMTP Authentication Failed / SMTP 认证失败\n\n- Check that you're using the authorization code, NOT your login password\n- Make sure IMAP/SMTP service is enabled in your email settings\n- QQ/163: You must explicitly enable IMAP service in email settings\n\n### Connection Timeout / 连接超时\n\n- Gmail/Yahoo/iCloud: Requires VPN in mainland China (国内需翻墙)\n- Check if firewall blocks ports 465/587/993\n- Try SSL (port 465) or STARTTLS (port 587) alternatively\n\n### 163 Requires Phone Verification / 163 邮箱提示需要手机验证\n\n- New IMAP enablement on 163 may require SMS verification\n- Wait 5-10 minutes after verification before trying again\n\n### Sending Rate Limits / 发送频率限制\n\n| Service | Daily Limit / 每日上限 |\n|---------|----------------------|\n| QQ Mail | 500 emails/day, 1 email/minute |\n| 163/126 Mail | 200 emails/day |\n| Gmail | 500 emails/day |\n| Outlook | 300 emails/day |\n| Yahoo | 500 emails/day |\n\n### Attachment Size Limits / 附件大小限制\n\n| Service | Attachment Limit / 附件上限 |\n|---------|---------------------------|\n| QQ Mail | 50MB |\n| 163/126 Mail | 50MB |\n| Gmail | 25MB |\n| Outlook | 20MB |\n| Yahoo | 25MB |\n| iCloud | 20MB |\n\nFile v1.2.1:references/templates.md\n\n# HTML 邮件模板 HTML Email Templates\n\n专业邮件 HTML 模板，支持中英文场景。使用时将占位符 `{变量名}` 替换为实际内容。\n\n---\n\n## 1. 商务报告模板 Business Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1a5276,#2e86c1);padding:30px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:22px;\">{report_title}</h1>\n<p style=\"margin:8px 0 0;font-size:14px;opacity:0.9;\">{report_period} | {report_date}</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{summary}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:20px 0;\">\n<thead><tr style=\"background:#eaf2f8;\">\n<th style=\"padding:12px 16px;text-align:left;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col1_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col2_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col3_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col4_header}</th>\n</tr></thead>\n<tbody>\n{table_rows}\n</tbody>\n</table>\n<p style=\"margin:20px 0 0;font-size:14px;color:#555;line-height:1.8;\">{detail_text}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:20px 40px;border-top:1px solid #eee;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {sender_department}<br>\n此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n**表格行模板：**\n```html\n<tr style=\"border-bottom:1px solid #eee;\">\n<td style=\"padding:10px 16px;font-size:14px;color:#333;\">{col1_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col2_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col3_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;font-weight:bold;color:{positive_color};\">{col4_value}</td>\n</tr>\n```\n\n---\n\n## 2. 会议邀请模板 Meeting Invitation\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#6c3483,#a569bd);padding:35px 40px;color:#ffffff;text-align:center;\">\n<h1 style=\"margin:0;font-size:24px;\">{event_title}</h1>\n<p style=\"margin:10px 0 0;font-size:16px;opacity:0.9;\">诚挚邀请您参加</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin:0 0 25px;\">\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;width:80px;\">🕐 时间</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_time}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">📍 地点</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_location}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">👤 主持人</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_host}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">📋 会议号</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{meeting_id}</td></tr>\n</table>\n<p style=\"margin:0 0 5px;font-size:14px;color:#333;font-weight:bold;\">会议议程：</p>\n<ol style=\"margin:5px 0 20px;padding-left:20px;font-size:14px;color:#555;line-height:2;\">\n{agenda_items}\n</ol>\n<p style=\"margin:0 0 5px;font-size:14px;color:#333;font-weight:bold;\">参会要求：</p>\n<ul style=\"margin:5px 0 20px;padding-left:20px;font-size:13px;color:#666;line-height:1.8;\">\n{requirements}\n</ul>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>\n<td align=\"center\" style=\"padding:10px;\"><a href=\"{accept_url}\" style=\"display:inline-block;padding:12px 30px;background:#27ae60;color:#ffffff;text-decoration:none;border-radius:5px;font-size:14px;font-weight:bold;\">✅ 接受邀请</a></td>\n<td align=\"center\" style=\"padding:10px;\"><a href=\"{decline_url}\" style=\"display:inline-block;padding:12px 30px;background:#e74c3c;color:#ffffff;text-decoration:none;border-radius:5px;font-size:14px;font-weight:bold;\">❌ 无法参加</a></td>\n</tr></table>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | 联系方式：{contact_info}\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 3. 通知公告模板 Notification / Announcement\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:#c0392b;padding:6px 40px;text-align:center;\">\n<span style=\"color:#ffffff;font-size:12px;font-weight:bold;letter-spacing:2px;\">🔴 重要通知 IMPORTANT NOTICE</span>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<h2 style=\"margin:0 0 5px;font-size:20px;color:#c0392b;\">{notice_title}</h2>\n<p style=\"margin:0 0 20px;font-size:13px;color:#999;\">发布时间：{notice_date} | 发布人：{notice_author}</p>\n<div style=\"padding:20px;background:#fdf2f2;border-left:4px solid #c0392b;margin:0 0 20px;font-size:14px;color:#333;line-height:1.8;\">\n{notice_summary}\n</div>\n<p style=\"margin:0 0 20px;font-size:14px;color:#333;line-height:1.8;\">{notice_detail}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f8f9fa;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:13px;color:#555;line-height:1.8;\">\n<strong>⚠️ 注意事项：</strong><br>\n{notice_action_items}\n</td></tr>\n</table>\n<p style=\"margin:0;font-size:14px;color:#555;\">如有疑问，请联系：{contact_info}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_department} | 此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 4. 感谢信模板 Thank You Letter\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#f39c12,#e67e22);padding:35px 40px;color:#ffffff;text-align:center;\">\n<h1 style=\"margin:0;font-size:28px;\">🙏 感谢您</h1>\n<p style=\"margin:10px 0 0;font-size:16px;opacity:0.9;\">Thank You</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">亲爱的 {recipient_name}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{thank_message}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fef9e7;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:14px;color:#7d6608;text-align:center;font-style:italic;line-height:1.6;\">\n\"{quote_text}\"\n</td></tr>\n</table>\n<p style=\"margin:0 0 10px;font-size:14px;color:#555;line-height:1.8;\">{additional_message}</p>\n<p style=\"margin:20px 0 0;font-size:15px;color:#333;\">此致<br>敬礼</p>\n<p style=\"margin:5px 0 0;font-size:14px;color:#666;\">{sender_name}<br>{sender_title}</p>\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 5. 周报/日报模板 Weekly/Daily Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1abc9c,#16a085);padding:25px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:20px;\">📋 {report_type}周报</h1>\n<p style=\"margin:5px 0 0;font-size:13px;opacity:0.9;\">{reporter_name} | {report_period}</p>\n</td></tr>\n<tr><td style=\"padding:25px 40px;\">\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#1abc9c;\">✅ 本周完成</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{completed_items}\n</ul>\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#e67e22;\">🔄 进行中</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{in_progress_items}\n</ul>\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#3498db;\">📋 下周计划</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{next_week_items}\n</ul>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fef9e7;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:14px;color:#7d6608;\">\n<strong>⚠️ 需协调事项：</strong>{blocker_items}\n</td></tr>\n</table>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {department} | {date}\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 6. 发票/单据通知模板 Invoice Notification\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#2c3e50,#34495e);padding:25px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:20px;\">📄 {document_type}通知</h1>\n<p style=\"margin:5px 0 0;font-size:13px;opacity:0.9;\">单据编号：{document_id}</p>\n</td></tr>\n<tr><td style=\"padding:25px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{document_description}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:0 0 20px;\">\n<tr style=\"background:#2c3e50;\"><td style=\"padding:10px 16px;color:#ffffff;font-size:13px;font-weight:bold;\">项目</td><td style=\"padding:10px 16px;color:#ffffff;font-size:13px;font-weight:bold;text-align:right;\">详情</td></tr>\n{document_rows}\n<tr style=\"background:#eaf2f8;border-top:2px solid #2c3e50;\"><td style=\"padding:10px 16px;font-size:14px;font-weight:bold;color:#2c3e50;\">合计</td><td style=\"padding:10px 16px;font-size:14px;font-weight:bold;color:#2c3e50;text-align:right;\">{total_amount}</td></tr>\n</table>\n<p style=\"margin:0 0 10px;font-size:13px;color:#999;\">📎 附件：{attachment_info}</p>\n<p style=\"margin:0 0 10px;font-size:13px;color:#999;\">⏰ 截止日期：{deadline}</p>\n<p style=\"margin:10px 0 0;font-size:14px;color:#555;\">如有疑问，请联系 {contact_person}（{contact_info}）</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_department} | 此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 7. 正式信函模板 Formal Letter\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"padding:40px;\">\n<p style=\"margin:0 0 5px;font-size:14px;color:#666;\">{sender_address}</p>\n<p style=\"margin:0 0 20px;font-size:13px;color:#999;\">{send_date}</p>\n<p style=\"margin:0 0 5px;font-size:15px;color:#333;\">{recipient_title} {recipient_name}</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#666;\">{recipient_address}</p>\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{subject_line}</p>\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{salutation}，</p>\n<div style=\"font-size:14px;color:#333;line-height:2;\">{letter_body}</div>\n<p style=\"margin:30px 0 5px;font-size:15px;color:#333;\">此致<br>敬礼</p>\n<p style=\"margin:20px 0 0;font-size:14px;color:#333;\">{sender_name}</p>\n<p style=\"margin:0;font-size:13px;color:#666;\">{sender_title}</p>\n<p style=\"margin:0;font-size:13px;color:#666;\">{sender_organization}</p>\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 使用说明\n\n1. 选择合适的模板\n2. 将 `{变量名}` 替换为实际内容\n3. 将替换后的 HTML 保存为文件，例如 `${OPENCLAW_WORKSPACE}/.emailbox_body.html`\n4. 使用 `--html-file` 参数发送：\n\n```bash\npython3 scripts/send_mail.py \\\n  --to recipient@example.com \\\n  --subject \"周报 - 张三 - 2026年第16周\" \\\n  --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n  --provider qq\n```\n\nFile v1.2.1:skill-card.md\n\n## Description:\n\nEmailbox helps agents send, receive, search, forward, and schedule email through IMAP/SMTP across common providers, with HTML templates, attachments, and document-data email workflows.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[tobewin](https://clawhub.ai/user/tobewin)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nEmployees and developers use Emailbox to automate mailbox workflows, including sending messages, reading and searching inboxes, forwarding mail, scheduling delivery, and packaging document or data outputs into emails through configured IMAP/SMTP accounts.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can access an email account and send message content, recipients, attachments, and downloaded mailbox data through the configured provider.\n\nMitigation: Use a dedicated or least-privileged mailbox where possible, use provider app passwords or authorization codes, and confirm recipients and attachments before sending sensitive material.\n\nRisk: Attachment downloads can write outside the chosen folder if unsafe filenames are present.\n\nMitigation: Download attachments only from trusted senders into an isolated directory, inspect filenames and paths before opening files, and avoid untrusted attachments until filename sanitization is confirmed.\n\nRisk: Scheduled emails are stored as plaintext in ~/.emailbox/queue until they are processed or cancelled.\n\nMitigation: Treat the queue as sensitive, restrict local filesystem access, avoid scheduling highly sensitive content, and clean up sent, failed, or cancelled queue entries.\n\nRisk: Email authorization codes in environment variables may be exposed through shell history, process listings, CI logs, or crash reports.\n\nMitigation: Prefer a system credential manager or session-only environment variables, avoid public or shared terminals, and unset EMAIL_AUTH and provider-specific auth variables after use.\n\n## Reference(s):\n\n- [Emailbox ClawHub skill page](https://clawhub.ai/tobewin/skills/emailbox)\n- [Email Provider Configuration](references/providers.md)\n- [Document Integration Workflows](references/integrations.md)\n- [HTML Email Templates](references/templates.md)\n- [Microsoft account security](https://account.microsoft.com/security)\n- [Google account security](https://myaccount.google.com/security)\n- [Google app passwords](https://myaccount.google.com/apppasswords)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance, files]\n\n**Output Format:** [Markdown guidance with shell commands, Python script invocations, optional generated text or HTML email bodies, downloaded attachment files, and scheduled-email queue entries.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Uses local Python standard-library scripts to perform IMAP/SMTP actions against configured email providers; scheduled email content is stored locally until processed.]\n\n## Skill Version(s):\n\n1.2.1 (source: server release metadata; artifact frontmatter says 1.2.0)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.2.1:LICENSE.txt\n\nMIT License\n\nCopyright (c) 2026 Emailbox Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nArchive v1.2.0: 10 files, 29107 bytes\n\nFiles: LICENSE.txt (1077b), references/integrations.md (7286b), references/providers.md (7510b), references/templates.md (15167b), scripts/receive_mail.py (18532b), scripts/schedule_mail.py (16796b), scripts/send_mail.py (14904b), skill-card.md (2601b), SKILL.md (13792b), _meta.json (127b)\n\nFile v1.2.0:SKILL.md\n\n---\nname: emailbox\ndescription: 职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachments, forwarding, data integration. 邮件收发、搜索、定时发送、附件、HTML模板、转发、文档数据联动。\nversion: 1.1.0\nlicense: MIT-0\nmetadata: {\"openclaw\": {\"emoji\": \"📬\", \"requires\": {\"bins\": [\"python3\"], \"env\": [\"EMAIL_ADDRESS\", \"EMAIL_AUTH\"]}, \"primaryEnv\": \"EMAIL_AUTH\"}}\n---\n\n# Emailbox - Professional Email Client & Data Integration\n\nIMAP/SMTP-based email toolkit supporting 12+ providers. Send, receive, search, forward, schedule emails with HTML templates, attachments, and document data integration.\n\n## Features\n\n- **Send**: Plain text, HTML, attachments, CC/BCC, reply, forward\n- **Receive**: List inbox, read emails, download attachments\n- **Search**: By keyword (subject/from/body), date range, sender\n- **Forward**: Fetch original email, forward to new recipients\n- **Schedule**: Send emails at a future time\n- **Templates**: 7 professional HTML email templates\n- **Integration**: Excel/OCR/PDF data → format → email\n- **Providers**: QQ, 163, 126, Sina, Outlook, Gmail, Yahoo, iCloud, Tencent Exmail, Ali Mail, Huawei, 139\n\n## Trigger\n\n- \"Send email to...\" / \"发邮件给...\"\n- \"Check inbox\" / \"查看收件箱\"\n- \"Reply to this email\" / \"回复这封邮件\"\n- \"Forward this email\" / \"转发这封邮件\"\n- \"Search emails from...\" / \"搜索...的邮件\"\n- \"Schedule email for...\" / \"定时发送...\"\n- \"Process data and email...\" / \"整理数据后发邮件\"\n- \"Attach this file...\" / \"添加附件...\"\n\n---\n\n## Step 0: Setup\n\n### Quick Start (Single Account)\n\n```bash\n# Set 2 environment variables and you're ready\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### Multi-Account Setup\n\n```bash\n# QQ Mail\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_auth_code\"\n\n# 163 Mail\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### Provider Auth Guide\n\nHow to get authorization codes for each provider → `references/providers.md`\n\n### Persistent Config\n\n**IMPORTANT: Never store email credentials in plaintext files.** Use your system's secure credential manager or session-only environment variables.\n\n```bash\n# Option A: Session-only (recommended for security)\n# Set environment variables in your current shell session only.\n# Credentials will NOT persist after the session ends.\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_auth_code\"\n\n# Option B: Keychain / secret manager\n# macOS: Use `security add-internet-password`\n# Linux: Use `secret-tool store` (libsecret)\n# Windows: Use Windows Credential Manager\n\n# Option C: Restricted file (if persistent config is required)\n# Create a file with restricted permissions that only you can read:\nmkdir -p ~/.emailbox && touch ~/.emailbox/credentials\nchmod 600 ~/.emailbox/credentials\n# Then add your credentials:\n# EMAIL_ADDRESS=your@qq.com\n# EMAIL_AUTH=your_auth_code\n# \n# Before running emailbox commands:\n# source ~/.emailbox/credentials\n```\n\n---\n\n## Step 1: Send Email\n\n### Plain Text\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"recipient@example.com\" \\\n  --subject \"Project Update\" \\\n  --body \"Hi, here is the project update...\" \\\n  --provider qq\n```\n\n### Multiple Recipients + CC/BCC\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com,team@company.com\" \\\n  --cc \"hr@company.com\" \\\n  --bcc \"archive@company.com\" \\\n  --subject \"Weekly Report\" \\\n  --body \"Please find the weekly report attached.\" \\\n  --provider 163\n```\n\n### HTML Email (Use Templates)\n\nChoose a template from `references/templates.md`, fill in variables, save as HTML, then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"client@company.com\" \\\n  --subject \"Sales Report - 2026W16\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --provider outlook\n```\n\n### With Attachments\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"finance@company.com\" \\\n  --subject \"Invoice - FP20260418001\" \\\n  --body \"Please find the invoice attached.\" \\\n  --attach \"/path/to/invoice.jpg\" \"/path/to/detail.xlsx\" \\\n  --provider qq\n```\n\n### High Priority + Read Receipt\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"manager@company.com\" \\\n  --subject \"URGENT: Contract Review\" \\\n  --body \"Please review the attached contract ASAP.\" \\\n  --importance high \\\n  --receipt \\\n  --provider outlook\n```\n\n### Reply to Email\n\nFirst get the Message-ID from reading an email (Step 3), then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"sender@example.com\" \\\n  --subject \"Re: Original Subject\" \\\n  --body \"Got it, confirmed.\" \\\n  --reply-to \"<msgid@example.com>\" \\\n  --provider qq\n```\n\n### Forward Email\n\nFirst get the original email metadata (Step 4), then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"colleague@company.com\" \\\n  --subject \"Fwd: Original Subject\" \\\n  --body \"Please see the forwarded message below.\" \\\n  --forward-from \"Original Sender <sender@example.com>\" \\\n  --forward-date \"Mon, 18 Apr 2026 10:30:00 +0800\" \\\n  --forward-subject \"Original Subject\" \\\n  --forward-to \"me@company.com\" \\\n  --provider qq\n```\n\n---\n\n## Step 2: Receive Email\n\n### List Inbox (Recent Emails)\n\n```bash\npython3 scripts/receive_mail.py --list\npython3 scripts/receive_mail.py --list --count 20\npython3 scripts/receive_mail.py --list --provider gmail\npython3 scripts/receive_mail.py --list --folder \"Sent Items\"\n```\n\n### Read Email Content\n\n```bash\npython3 scripts/receive_mail.py --read 123 --provider qq\n```\n\n### Download Attachments\n\n```bash\npython3 scripts/receive_mail.py --read 123 --download-attachment 123 \\\n  --save-dir \"${OPENCLAW_WORKSPACE:-$PWD}/downloads\"\n```\n\n---\n\n## Step 3: Search Email\n\n```bash\n# Search by keyword (searches subject, from, AND body)\npython3 scripts/receive_mail.py --search \"contract\" --provider qq\n\n# Search by sender\npython3 scripts/receive_mail.py --search \"\" --from-filter \"zhangsan@company.com\"\n\n# Search by date range\npython3 scripts/receive_mail.py --search \"report\" --since \"2026-04-01\"\n\n# Combined search\npython3 scripts/receive_mail.py --search \"invoice\" --from-filter \"finance@company.com\" --since \"2026-04-01\" --count 5\n```\n\n### IMAP Folders\n\nAccess folders beyond INBOX:\n```bash\npython3 scripts/receive_mail.py --list --folder \"Sent Items\"\npython3 scripts/receive_mail.py --list --folder \"Drafts\"\npython3 scripts/receive_mail.py --list --folder \"Trash\"\n```\n\nCommon folder names:\n- Gmail: `[Gmail]/Sent Mail`, `[Gmail]/Drafts`, `[Gmail]/Spam`\n- QQ Mail: `Sent Messages`, `Drafts`, `Deleted Messages`\n- 163 Mail: `Sent`, `Drafts`, `Deleted`\n- Outlook: `SentItems`, `Drafts`, `Deleted`\n\n---\n\n## Step 4: Forward Email\n\n```bash\n# Step 1: Get original email metadata\npython3 scripts/receive_mail.py --forward 123 --provider qq\n\n# Output includes FORWARD_META with From/To/CC/Date/Subject/Message-ID\n\n# Step 2: Forward using the metadata\npython3 scripts/send_mail.py \\\n  --to \"colleague@company.com\" \\\n  --subject \"Fwd: Original Subject\" \\\n  --body \"FYI, please see below.\" \\\n  --forward-from \"Original Sender <sender@example.com>\" \\\n  --forward-date \"Mon, 18 Apr 2026 10:30:00 +0800\" \\\n  --forward-subject \"Original Subject\" \\\n  --forward-to \"me@company.com\" \\\n  --provider qq\n```\n\n---\n\n## Step 5: Document Data Integration\n\nCombine other Skills' output with email sending.\n\nDetailed workflows → `references/integrations.md`\n\n### Common Patterns\n\n```\n1. Excel → Email: Read data → HTML table → send\n2. OCR → Email: Recognize invoice → extract key info → send\n3. PDF → Email: Process PDF → summary + attachment → send\n4. Data Analysis → Email: Analyze data → conclusions → send\n5. Scheduled Report: Generate content → schedule → send\n```\n\n### Excel Data → Email Example\n\n```bash\n# Step 1: Read and format data (use excel-studio or python3)\n# Step 2: Save HTML content using a template from references/templates.md\n# Step 3: Send\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com\" \\\n  --subject \"Sales Report $(date +%Y%m%d)\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --attach \"/path/to/report.xlsx\" \\\n  --provider qq\n```\n\n### Related Skills\n\n| Skill | Integration | Scenario |\n|-------|------------|----------|\n| china-doc-ocr | OCR → email content | Invoice/contract recognition then email |\n| excel-studio | Excel → table email | Data reports, financial statements |\n| pdf-studio | PDF → email attachment | PDF report sending |\n| data-analyzer | Analysis → email conclusions | Data insight notifications |\n\n---\n\n## Step 6: Schedule Email\n\n### Send at Specific Time\n\n```bash\npython3 scripts/schedule_mail.py \\\n  --schedule --at \"2026-04-19 09:00\" \\\n  --to \"boss@company.com\" \\\n  --subject \"Daily Report - 2026-04-19\" \\\n  --body \"Today's work summary...\" \\\n  --provider qq\n```\n\n### Send in N Minutes\n\n```bash\npython3 scripts/schedule_mail.py \\\n  --schedule --in 30 \\\n  --to \"client@example.com\" \\\n  --subject \"Follow up\" \\\n  --body \"Following up on our meeting...\" \\\n  --provider 163\n```\n\n### Manage Scheduled Emails\n\n```bash\n# View scheduled emails\npython3 scripts/schedule_mail.py --list-scheduled\n\n# Cancel a scheduled email\npython3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n# Manually process due emails\npython3 scripts/schedule_mail.py --process-queue\n```\n\n### Auto-Processing (Manual Setup Only)\n\n**⚠️ The schedule script will NEVER modify your crontab automatically.** You must manually confirm any crontab changes.\n\n```bash\n# Step 1: Check your current crontab first\ncrontab -l > ~/crontab_backup.txt\n\n# Step 2: Add the emailbox processor manually (review before adding!)\n# Add this line to your crontab ONLY if you want auto-processing:\n# * * * * * python3 /path/to/emailbox/scripts/schedule_mail.py --process-queue\n\n# Step 3: To remove later, edit your crontab and remove the line\n```\n\n---\n\n## Step 7: HTML Email Templates\n\n7 professional templates available → `references/templates.md`\n\n| Template | Use Case |\n|----------|----------|\n| Business Report | Data reports, financial summaries |\n| Meeting Invitation | Meetings, events, interviews |\n| Notification / Announcement | Company announcements, system alerts |\n| Thank You Letter | Appreciation, follow-ups |\n| Weekly/Daily Report | Work progress updates |\n| Invoice Notification | Invoice/receipt processing |\n| Formal Letter | Official correspondence |\n\n---\n\n## Provider Configuration\n\n12+ providers with IMAP/SMTP config and auth code guides → `references/providers.md`\n\n| Provider | IMAP | SMTP | Port | Auth | China |\n|----------|------|------|------|------|-------|\n| QQ Mail | imap.qq.com | smtp.qq.com | 465 | Authorization code | Yes |\n| 163 Mail | imap.163.com | smtp.163.com | 465 | Client password | Yes |\n| 126 Mail | imap.126.com | smtp.126.com | 465 | Client password | Yes |\n| Sina | imap.sina.com | smtp.sina.com | 465 | Enable IMAP | Yes |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | App password | Yes |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | App password | VPN |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | App password | VPN |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | App password | VPN |\n| Tencent Exmail | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | Enable IMAP | Yes |\n| Ali Mail | imap.mxhichina.com | smtp.mxhichina.com | 465 | Enable IMAP | Yes |\n| Huawei | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | App password | Yes |\n| 139 Mail | imap.mail.139.com | smtp.mail.139.com | 465 | Enable IMAP | Yes |\n\n---\n\n## Error Handling\n\n```\nError                              → Solution\n──────────────────────────────────────────────────────────\nSMTP auth failed                   → Check authorization code, see providers.md\nIMAP connection failed             → Verify IMAP enabled, check network\nConnection timeout                 → Gmail/Yahoo/iCloud need VPN in China\nSMTP auth code error (QQ/163)     → Use authorization code, NOT login password\nSending rate limit                 → QQ: 1/min, 500/day; 163: 200/day; Gmail: 500/day\nAttachment too large               → QQ: 50MB; Gmail: 25MB; Outlook: 20MB\nIMAP not enabled                   → Enable in email settings, see providers.md\n163 requires phone verification    → Verify via SMS, wait 5-10 minutes\n```\n\n---\n\n## Privacy & Security\n\n- Direct IMAP/SMTP connection to email servers, no third-party data transfer\n- **Credentials should be stored in environment variables only, NOT in plaintext files**\n- Use provider-specific app passwords/authorization codes (NOT your login password)\n- Authorization codes are email-specific, cannot be used to log into webmail\n- Schedule queue stored in `~/.emailbox/queue/` — review and clean up regularly\n- **This skill will NEVER modify your crontab or system scheduler without your explicit manual action**\n- For maximum security, use a dedicated email account for automated sending\n\n## Notes\n\n- Requires IMAP/SMTP service enabled and authorization code configured\n- Gmail/Yahoo/iCloud require VPN in mainland China\n- QQ Mail limits: 500 emails/day, 1 email/minute\n- 163/126 Mail limits: 200 emails/day\n- Attachment size limits vary by provider (QQ: 50MB, Gmail: 25MB, Outlook: 20MB)\n- Scheduled sending uses a local queue in `~/.emailbox/queue/`; processing requires manual crontab setup\n- **Always use app passwords/authorization codes, never your real email login password**\n\nFile v1.2.0:_meta.json\n\n{\n  \"ownerId\": \"kn75z6gevjsyrznm7dg2ez6sen82h8sz\",\n  \"slug\": \"emailbox\",\n  \"version\": \"1.2.0\",\n  \"publishedAt\": 1776528702177\n}\n\nFile v1.2.0:references/integrations.md\n\n# 文档数据联动 Document Integration\n\n邮件与文档数据处理的一体化工作流。结合其他 Skills 的能力，实现\"数据处理 → 格式化 → 邮件发送\"的自动化。\n\n---\n\n## 场景总览\n\n| 场景 | 数据来源 | 邮件输出 | 关联 Skill |\n|------|----------|----------|-----------|\n| Excel 报表发送 | .xlsx/.csv 数据 | HTML 表格 + 附件 | excel-studio |\n| 发票识别+邮件 | 图片/PDF 发票 | 结构化摘要 + 附件 | china-doc-ocr |\n| 合同审核+邮件 | 合同 PDF | 审核要点 + 附件 | china-doc-ocr, china-legal-analysis |\n| PDF 报告发送 | PDF 文件 | 摘要 + 附件 | pdf-studio |\n| 简历解析+邮件 | 简历 PDF/Word | 候选人摘要 + 附件 | china-doc-ocr |\n| 数据分析+邮件 | 原始数据 | 分析结论 + 图表 | data-analyzer |\n\n---\n\n## 工作流模板\n\n### 流程 1：Excel 数据 → 格式化邮件\n\n```\n用户请求：\"把这个 Excel 的销售数据做成表格发邮件给老板\"\n↓\nStep 1: 读取 Excel 文件\n  → 使用 excel-studio 读取数据\n  → 或使用 python3 + openpyxl 直接读取\n↓\nStep 2: 数据处理与格式化\n  → 提取关键指标（总计、变化、排名等）\n  → 生成 HTML 表格（使用 templates.md 中商务报告模板）\n  → 生成纯文本摘要（作为 fallback）\n↓\nStep 3: 生成邮件内容并保存\n  → 将 HTML 保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.html\n  → 将纯文本保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.txt\n↓\nStep 4: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to boss@company.com \\\n    --subject \"销售数据周报 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/sales_data.xlsx \\\n    --provider qq\n```\n\n### 流程 2：OCR 识别 → 邮件通知\n\n```\n用户请求：\"识别这张发票，把结果发邮件给财务\"\n↓\nStep 1: OCR 识别\n  → 使用 china-doc-ocr 识别发票图片/PDF\n  → 提取关键字段：发票号码、金额、日期、购方/销方信息\n↓\nStep 2: 格式化邮件内容\n  → 使用 templates.md 中的发票通知模板\n  → 填入识别出的字段数据\n  → 生成纯文本摘要\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to finance@company.com \\\n    --subject \"发票处理 - ${invoice_number}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/invoice.jpg \\\n    --provider 163\n```\n\n### 流程 3：合同审核 → 邮件汇报\n\n```\n用户请求：\"审核这份合同后把要点发邮件给法务\"\n↓\nStep 1: 识别合同\n  → 使用 china-doc-ocr 识别合同文本\n↓\nStep 2: 法律分析\n  → 使用 china-legal-analysis 分析合同条款\n  → 提取风险点和审核意见\n↓\nStep 3: 格式化并发送\n  python3 scripts/send_mail.py \\\n    --to legal@company.com \\\n    --subject \"合同审核报告 - ${contract_name}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/contract.pdf \\\n    --importance high \\\n    --provider qq\n```\n\n### 流程 4：简历解析 → 转发 HR\n\n```\n用户请求：\"解析这份简历然后转发给HR\"\n↓\nStep 1: 识别简历\n  → 使用 china-doc-ocr 识别简历 PDF/图片\n↓\nStep 2: 结构化提取\n  → 提取姓名、学历、工作经验、技能等\n  → 生成候选人摘要卡片\n↓\nStep 3: 转发邮件\n  python3 scripts/send_mail.py \\\n    --to hr@company.com \\\n    --subject \"候选人推荐 - ${candidate_name} - ${position}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/resume.pdf\n```\n\n### 流程 5：数据分析 → 邮件报告\n\n```\n用户请求：\"分析这份数据后发邮件给团队\"\n↓\nStep 1: 读取和数据\n  → 使用 data-analyzer 或 python3 分析 CSV/Excel\n↓\nStep 2: 生成分析报告\n  → 关键指标、趋势、异常值\n  → 生成 HTML 报告格式\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to \"team1@company.com,team2@company.com\" \\\n    --subject \"数据分析报告 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/data.xlsx\n```\n\n### 流程 6：定时日报/周报\n\n```\n用户请求：\"每天早上9点自动发日报给老板\"\n↓\nStep 1: 收集日报内容\n  → 用户或 AI 生成日报内容\n  → 保存为 HTML 文件\n↓\nStep 2: 设置定时发送\n  python3 scripts/schedule_mail.py \\\n    --schedule \\\n    --at \"2026-04-19 09:00\" \\\n    --to boss@company.com \\\n    --subject \"工作日报 - $(date +%Y-%m-%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --provider qq\n↓\nStep 3: 管理定时任务\n  # 查看已安排的定时邮件\n  python3 scripts/schedule_mail.py --list-scheduled\n\n  # 取消定时邮件\n  python3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n  # 手动处理到期队列\n  python3 scripts/schedule_mail.py --process-queue\n```\n\n---\n\n## 数据格式转换速查\n\n### 从 Excel 生成 HTML 表格\n\n```python\nimport json\n\n# 假设从 Excel 读取的数据格式\ndata = [\n    [\"指标\", \"本周\", \"上周\", \"变化\"],\n    [\"营收\", \"¥128万\", \"¥115万\", \"↑11.3%\"],\n    [\"用户数\", \"12,345\", \"11,890\", \"↑3.8%\"],\n    [\"转化率\", \"3.2%\", \"2.9%\", \"↑0.3pp\"],\n]\n\n# 生成 HTML 表格行\ntable_rows = \"\"\nfor i, row in enumerate(data):\n    if i == 0:\n        continue  # 跳过表头（模板已有）\n    color = \"#27ae60\" if \"↑\" in row[3] else \"#e74c3c\"\n    table_rows += f'<tr style=\"border-bottom:1px solid #eee;\">'\n    for j, cell in enumerate(row):\n        align = \"text-align:right\" if j > 0 else \"\"\n        font = \"font-weight:bold\" if j == 3 else \"\"\n        row_color = f'color:{color}' if j == 3 else \"\"\n        table_rows += f'<td style=\"padding:10px 16px;font-size:14px;{align};{font};{row_color};\">{cell}</td>'\n    table_rows += '</tr>\\n'\n```\n\n### 从 OCR 结果生成邮件内容\n\n```python\n# OCR 识别结果（从 china-doc-ocr 获取）\nocr_result = {\n    \"invoice_number\": \"12345678\",\n    \"amount\": \"¥5,280.00\",\n    \"date\": \"2026年4月18日\",\n    \"seller\": \"XX科技有限公司\",\n    \"buyer\": \"YY集团有限公司\",\n}\n\n# 生成摘要文本\nsummary = f\"\"\"发票识别结果：\n发票号码：{ocr_result['invoice_number']}\n开票日期：{ocr_result['date']}\n金额：{ocr_result['amount']}\n销售方：{ocr_result['seller']}\n购买方：{ocr_result['buyer']}\n\"\"\"\n```\n\n---\n\n## 与 Skills 联动清单\n\n| Skill | 联动方式 | 典型场景 |\n|-------|----------|----------|\n| china-doc-ocr | OCR 识别 → 邮件内容 | 发票、合同、证件识别后邮件发送 |\n| excel-studio | 读取 Excel → 表格邮件 | 数据报表、财务报告 |\n| pdf-studio | PDF 处理 → 邮件附件 | PDF 报告发送 |\n| data-analyzer | 数据分析 → 结论邮件 | 数据洞察通知 |\n| china-legal-analysis | 合同审核 → 邮件通知 | 合同风险点邮件通知 |\n| interview-pro | 面试反馈 → 邮件通知 | 候选人评估结果邮件 |\n\nFile v1.2.0:references/providers.md\n\n# 邮箱服务商配置 Email Provider Configuration\n\n## 12+ 服务商 IMAP/SMTP 配置\n\n| 服务商 | IMAP 服务器 | SMTP 服务器 | SMTP 端口 | SSL | 环境变量 |\n|--------|-------------|-------------|----------|-----|----------|\n| QQ 邮箱 | imap.qq.com | smtp.qq.com | 465 | SSL | EMAIL_QQ / EMAIL_QQ_AUTH |\n| 163 邮箱 | imap.163.com | smtp.163.com | 465 | SSL | EMAIL_163 / EMAIL_163_AUTH |\n| 126 邮箱 | imap.126.com | smtp.126.com | 465 | SSL | EMAIL_126 / EMAIL_126_AUTH |\n| 新浪邮箱 | imap.sina.com | smtp.sina.com | 465 | SSL | EMAIL_SINA / EMAIL_SINA_AUTH |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | STARTTLS | EMAIL_OUTLOOK / EMAIL_OUTLOOK_AUTH |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | STARTTLS | EMAIL_GMAIL / EMAIL_GMAIL_AUTH |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | STARTTLS | EMAIL_YAHOO / EMAIL_YAHOO_AUTH |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | STARTTLS | EMAIL_ICLOUD / EMAIL_ICLOUD_AUTH |\n| 腾讯企业邮箱 | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | SSL | EMAIL_EXMAIL / EMAIL_EXMAIL_AUTH |\n| 阿里企业邮箱 | imap.mxhichina.com | smtp.mxhichina.com | 465 | SSL | EMAIL_ALIMAIL / EMAIL_ALIMAIL_AUTH |\n| 华为邮箱 | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | SSL | EMAIL_HUAWEI / EMAIL_HUAWEI_AUTH |\n| 139 邮箱 | imap.mail.139.com | smtp.mail.139.com | 465 | SSL | EMAIL_139 / EMAIL_139_AUTH |\n\n---\n\n## 环境变量配置\n\n### 单账号模式（推荐新手）\n\n最简配置，只需 2 个环境变量：\n\n```bash\nexport EMAIL_ADDRESS=\"your@email.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### 多账号模式（支持多个邮箱）\n\n每个邮箱单独配置：\n\n```bash\n# QQ 邮箱\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_authorization_code\"\n\n# 163 邮箱\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Outlook\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"outlook_app_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### 优先级规则\n\n1. 命令行指定 `--from-addr` 和 `--provider` 最高优先\n2. 对应服务商的环境变量（如 `EMAIL_QQ` / `EMAIL_QQ_AUTH`）\n3. 通用环境变量 `EMAIL_ADDRESS` / `EMAIL_AUTH`\n\n---\n\n## Authorization Code Setup / 授权码获取教程\n\n### QQ Mail / QQ 邮箱\n\n1. Log in to QQ Mail (mail.qq.com) → Settings (设置) → Account (账号)\n2. Find \"POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV Service\"\n3. Enable IMAP/SMTP service\n4. Click \"Generate Authorization Code\" (生成授权码)\n5. Follow prompts to send SMS verification from your phone\n6. Receive 16-character authorization code (no spaces)\n\n```bash\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"abcdefghijklmnop\"\n```\n\n**Note:** QQ Mail authorization code is 16 letters, NOT your QQ password.\n\n### 163 Mail / 163 邮箱\n\n1. Log in to 163 Mail (mail.163.com) → Settings (设置) → POP3/SMTP/IMAP\n2. Enable \"IMAP/SMTP Service\"\n3. Click \"Client Authorization Password\" (客户端授权密码)\n4. Verify via SMS, then set the authorization password\n\n```bash\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"your_client_password\"\n```\n\n**Note:** 163 Mail requires authorization password, NOT your login password.\n\n### 126 Mail / 126 邮箱\n\n1. Log in to 126 Mail (mail.126.com) → Settings → POP3/SMTP/IMAP\n2. Enable IMAP service\n3. Set client authorization password\n\n```bash\nexport EMAIL_126=\"your@126.com\"\nexport EMAIL_126_AUTH=\"your_client_password\"\n```\n\n### Sina Mail / 新浪邮箱\n\n1. Log in to Sina Mail (mail.sina.com) → Settings → Client Settings\n2. Enable IMAP/SMTP service\n3. 部分账号需要通过手机验证\n\n```bash\nexport EMAIL_SINA=\"your@sina.com\"\nexport EMAIL_SINA_AUTH=\"your_password\"\n```\n\n### Outlook / Hotmail\n\n1. Visit https://account.microsoft.com/security\n2. Advanced security options → App passwords\n3. Generate a new app password\n\n```bash\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"your_app_password\"\n```\n\n**Note:** If two-step verification is enabled, you MUST use an app password, not your login password. Microsoft is deprecating basic auth — OAuth2 Modern Auth may be required in the future.\n\n### Gmail\n\n1. Enable two-step verification: https://myaccount.google.com/security\n2. Create an app password: https://myaccount.google.com/apppasswords\n3. Select \"Mail\" and device, generate the 16-character password\n4. **Google removed \"Less Secure Apps\" access in 2022** — only App Passwords work now\n\n```bash\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"abcd efgh ijkl mnop\"\n```\n\n**Note:** Gmail app passwords may contain spaces; no need to remove them. Requires VPN in mainland China.\n\n### Yahoo Mail\n\n1. Log in to Yahoo → Account Security → Generate app password\n2. Yahoo no longer supports \"Less Secure Apps\" — app password is required\n\n```bash\nexport EMAIL_YAHOO=\"your@yahoo.com\"\nexport EMAIL_YAHOO_AUTH=\"your_app_password\"\n```\n\n**Note:** Requires VPN in mainland China.\n\n### iCloud Mail\n\n1. Apple ID → Account Settings → App-Specific Passwords\n2. Generate a password\n\n```bash\nexport EMAIL_ICLOUD=\"your@icloud.com\"\nexport EMAIL_ICLOUD_AUTH=\"your_app_specific_password\"\n```\n\n**Note:** Requires VPN in mainland China.\n\n### Tencent Exmail / 腾讯企业邮箱\n\n1. Log in to enterprise mail (exmail.qq.com) → Settings → Client Settings\n2. Confirm IMAP service is enabled\n3. Use enterprise email password or authorization code\n\n```bash\nexport EMAIL_EXMAIL=\"your@company.com\"\nexport EMAIL_EXMAIL_AUTH=\"your_password\"\n```\n\n### Ali Mail / 阿里企业邮箱\n\n1. Log in to Ali Mail (mail.mxhichina.com) → Settings → POP/IMAP Settings\n2. Enable IMAP service\n\n```bash\nexport EMAIL_ALIMAIL=\"your@company.com\"\nexport EMAIL_ALIMAIL_AUTH=\"your_password\"\n```\n\n### Huawei Mail / 华为邮箱\n\n1. Log in to Huawei Mail (mail.hicloud.com) → Settings → Account Security\n2. Generate app password\n\n```bash\nexport EMAIL_HUAWEI=\"your@hicloud.com\"\nexport EMAIL_HUAWEI_AUTH=\"your_app_password\"\n```\n\n### 139 Mail / 139 邮箱 (China Mobile)\n\n1. Log in to 139 Mail (mail.139.com) → Settings → Account\n2. Enable IMAP service\n\n```bash\nexport EMAIL_139=\"your@139.com\"\nexport EMAIL_139_AUTH=\"your_password\"\n```\n\n---\n\n## Common Issues / 常见问题\n\n### SMTP Authentication Failed / SMTP 认证失败\n\n- Check that you're using the authorization code, NOT your login password\n- Make sure IMAP/SMTP service is enabled in your email settings\n- QQ/163: You must explicitly enable IMAP service in email settings\n\n### Connection Timeout / 连接超时\n\n- Gmail/Yahoo/iCloud: Requires VPN in mainland China (国内需翻墙)\n- Check if firewall blocks ports 465/587/993\n- Try SSL (port 465) or STARTTLS (port 587) alternatively\n\n### 163 Requires Phone Verification / 163 邮箱提示需要手机验证\n\n- New IMAP enablement on 163 may require SMS verification\n- Wait 5-10 minutes after verification before trying again\n\n### Sending Rate Limits / 发送频率限制\n\n| Service | Daily Limit / 每日上限 |\n|---------|----------------------|\n| QQ Mail | 500 emails/day, 1 email/minute |\n| 163/126 Mail | 200 emails/day |\n| Gmail | 500 emails/day |\n| Outlook | 300 emails/day |\n| Yahoo | 500 emails/day |\n\n### Attachment Size Limits / 附件大小限制\n\n| Service | Attachment Limit / 附件上限 |\n|---------|---------------------------|\n| QQ Mail | 50MB |\n| 163/126 Mail | 50MB |\n| Gmail | 25MB |\n| Outlook | 20MB |\n| Yahoo | 25MB |\n| iCloud | 20MB |\n\nFile v1.2.0:references/templates.md\n\n# HTML 邮件模板 HTML Email Templates\n\n专业邮件 HTML 模板，支持中英文场景。使用时将占位符 `{变量名}` 替换为实际内容。\n\n---\n\n## 1. 商务报告模板 Business Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1a5276,#2e86c1);padding:30px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:22px;\">{report_title}</h1>\n<p style=\"margin:8px 0 0;font-size:14px;opacity:0.9;\">{report_period} | {report_date}</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{summary}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:20px 0;\">\n<thead><tr style=\"background:#eaf2f8;\">\n<th style=\"padding:12px 16px;text-align:left;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col1_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col2_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col3_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col4_header}</th>\n</tr></thead>\n<tbody>\n{table_rows}\n</tbody>\n</table>\n<p style=\"margin:20px 0 0;font-size:14px;color:#555;line-height:1.8;\">{detail_text}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:20px 40px;border-top:1px solid #eee;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {sender_department}<br>\n此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n**表格行模板：**\n```html\n<tr style=\"border-bottom:1px solid #eee;\">\n<td style=\"padding:10px 16px;font-size:14px;color:#333;\">{col1_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col2_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col3_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;font-weight:bold;color:{positive_color};\">{col4_value}</td>\n</tr>\n```\n\n---\n\n## 2. 会议邀请模板 Meeting Invitation\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#6c3483,#a569bd);padding:35px 40px;color:#ffffff;text-align:center;\">\n<h1 style=\"margin:0;font-size:24px;\">{event_title}</h1>\n<p style=\"margin:10px 0 0;font-size:16px;opacity:0.9;\">诚挚邀请您参加</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin:0 0 25px;\">\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;width:80px;\">🕐 时间</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_time}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">📍 地点</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_location}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">👤 主持人</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_host}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">📋 会议号</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{meeting_id}</td></tr>\n</table>\n<p style=\"margin:0 0 5px;font-size:14px;color:#333;font-weight:bold;\">会议议程：</p>\n<ol style=\"margin:5px 0 20px;padding-left:20px;font-size:14px;color:#555;line-height:2;\">\n{agenda_items}\n</ol>\n<p style=\"margin:0 0 5px;font-size:14px;color:#333;font-weight:bold;\">参会要求：</p>\n<ul style=\"margin:5px 0 20px;padding-left:20px;font-size:13px;color:#666;line-height:1.8;\">\n{requirements}\n</ul>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>\n<td align=\"center\" style=\"padding:10px;\"><a href=\"{accept_url}\" style=\"display:inline-block;padding:12px 30px;background:#27ae60;color:#ffffff;text-decoration:none;border-radius:5px;font-size:14px;font-weight:bold;\">✅ 接受邀请</a></td>\n<td align=\"center\" style=\"padding:10px;\"><a href=\"{decline_url}\" style=\"display:inline-block;padding:12px 30px;background:#e74c3c;color:#ffffff;text-decoration:none;border-radius:5px;font-size:14px;font-weight:bold;\">❌ 无法参加</a></td>\n</tr></table>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | 联系方式：{contact_info}\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 3. 通知公告模板 Notification / Announcement\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:#c0392b;padding:6px 40px;text-align:center;\">\n<span style=\"color:#ffffff;font-size:12px;font-weight:bold;letter-spacing:2px;\">🔴 重要通知 IMPORTANT NOTICE</span>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<h2 style=\"margin:0 0 5px;font-size:20px;color:#c0392b;\">{notice_title}</h2>\n<p style=\"margin:0 0 20px;font-size:13px;color:#999;\">发布时间：{notice_date} | 发布人：{notice_author}</p>\n<div style=\"padding:20px;background:#fdf2f2;border-left:4px solid #c0392b;margin:0 0 20px;font-size:14px;color:#333;line-height:1.8;\">\n{notice_summary}\n</div>\n<p style=\"margin:0 0 20px;font-size:14px;color:#333;line-height:1.8;\">{notice_detail}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f8f9fa;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:13px;color:#555;line-height:1.8;\">\n<strong>⚠️ 注意事项：</strong><br>\n{notice_action_items}\n</td></tr>\n</table>\n<p style=\"margin:0;font-size:14px;color:#555;\">如有疑问，请联系：{contact_info}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_department} | 此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 4. 感谢信模板 Thank You Letter\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#f39c12,#e67e22);padding:35px 40px;color:#ffffff;text-align:center;\">\n<h1 style=\"margin:0;font-size:28px;\">🙏 感谢您</h1>\n<p style=\"margin:10px 0 0;font-size:16px;opacity:0.9;\">Thank You</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">亲爱的 {recipient_name}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{thank_message}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fef9e7;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:14px;color:#7d6608;text-align:center;font-style:italic;line-height:1.6;\">\n\"{quote_text}\"\n</td></tr>\n</table>\n<p style=\"margin:0 0 10px;font-size:14px;color:#555;line-height:1.8;\">{additional_message}</p>\n<p style=\"margin:20px 0 0;font-size:15px;color:#333;\">此致<br>敬礼</p>\n<p style=\"margin:5px 0 0;font-size:14px;color:#666;\">{sender_name}<br>{sender_title}</p>\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 5. 周报/日报模板 Weekly/Daily Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1abc9c,#16a085);padding:25px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:20px;\">📋 {report_type}周报</h1>\n<p style=\"margin:5px 0 0;font-size:13px;opacity:0.9;\">{reporter_name} | {report_period}</p>\n</td></tr>\n<tr><td style=\"padding:25px 40px;\">\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#1abc9c;\">✅ 本周完成</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{completed_items}\n</ul>\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#e67e22;\">🔄 进行中</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{in_progress_items}\n</ul>\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#3498db;\">📋 下周计划</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{next_week_items}\n</ul>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fef9e7;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:14px;color:#7d6608;\">\n<strong>⚠️ 需协调事项：</strong>{blocker_items}\n</td></tr>\n</table>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {department} | {date}\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 6. 发票/单据通知模板 Invoice Notification\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#2c3e50,#34495e);padding:25px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:20px;\">📄 {document_type}通知</h1>\n<p style=\"margin:5px 0 0;font-size:13px;opacity:0.9;\">单据编号：{document_id}</p>\n</td></tr>\n<tr><td style=\"padding:25px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{document_description}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:0 0 20px;\">\n<tr style=\"background:#2c3e50;\"><td style=\"padding:10px 16px;color:#ffffff;font-size:13px;font-weight:bold;\">项目</td><td style=\"padding:10px 16px;color:#ffffff;font-size:13px;font-weight:bold;text-align:right;\">详情</td></tr>\n{document_rows}\n<tr style=\"background:#eaf2f8;border-top:2px solid #2c3e50;\"><td style=\"padding:10px 16px;font-size:14px;font-weight:bold;color:#2c3e50;\">合计</td><td style=\"padding:10px 16px;font-size:14px;font-weight:bold;color:#2c3e50;text-align:right;\">{total_amount}</td></tr>\n</table>\n<p style=\"margin:0 0 10px;font-size:13px;color:#999;\">📎 附件：{attachment_info}</p>\n<p style=\"margin:0 0 10px;font-size:13px;color:#999;\">⏰ 截止日期：{deadline}</p>\n<p style=\"margin:10px 0 0;font-size:14px;color:#555;\">如有疑问，请联系 {contact_person}（{contact_info}）</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_department} | 此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 7. 正式信函模板 Formal Letter\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"padding:40px;\">\n<p style=\"margin:0 0 5px;font-size:14px;color:#666;\">{sender_address}</p>\n<p style=\"margin:0 0 20px;font-size:13px;color:#999;\">{send_date}</p>\n<p style=\"margin:0 0 5px;font-size:15px;color:#333;\">{recipient_title} {recipient_name}</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#666;\">{recipient_address}</p>\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{subject_line}</p>\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{salutation}，</p>\n<div style=\"font-size:14px;color:#333;line-height:2;\">{letter_body}</div>\n<p style=\"margin:30px 0 5px;font-size:15px;color:#333;\">此致<br>敬礼</p>\n<p style=\"margin:20px 0 0;font-size:14px;color:#333;\">{sender_name}</p>\n<p style=\"margin:0;font-size:13px;color:#666;\">{sender_title}</p>\n<p style=\"margin:0;font-size:13px;color:#666;\">{sender_organization}</p>\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 使用说明\n\n1. 选择合适的模板\n2. 将 `{变量名}` 替换为实际内容\n3. 将替换后的 HTML 保存为文件，例如 `${OPENCLAW_WORKSPACE}/.emailbox_body.html`\n4. 使用 `--html-file` 参数发送：\n\n```bash\npython3 scripts/send_mail.py \\\n  --to recipient@example.com \\\n  --subject \"周报 - 张三 - 2026年第16周\" \\\n  --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n  --provider qq\n```\n\nFile v1.2.0:skill-card.md\n\n## Description: <br>\nEmailbox is an IMAP/SMTP email toolkit for 12+ providers that helps agents send, receive, search, forward, schedule, and format emails with templates, attachments, and document-data workflows. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[tobewin](https://clawhub.ai/user/tobewin) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nEmployees, external users, developers, and automation agents use Emailbox to operate authenticated mailboxes through IMAP/SMTP, including sending messages, reading and searching inboxes, forwarding mail, scheduling messages, and packaging document-derived content into email. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill handles mailbox credentials and sensitive email content. <br>\nMitigation: Use session-only environment variables or a system secret manager, avoid plaintext credential files, and prefer a dedicated low-privilege email account. <br>\nRisk: Email sending or forwarding can expose sensitive documents or messages to unintended recipients. <br>\nMitigation: Verify recipients, attachments, and generated content before sending sensitive messages. <br>\nRisk: Downloaded attachments from untrusted mail can be unsafe. <br>\nMitigation: Do not download attachments from untrusted senders until filename handling is tightened, and scan attachments before opening them. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/tobewin/emailbox) <br>\n- [Provider Configuration Guide](artifact/references/providers.md) <br>\n- [Document Integration Workflows](artifact/references/integrations.md) <br>\n- [HTML Email Templates](artifact/references/templates.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Files] <br>\n**Output Format:** [Markdown guidance with bash command examples, email text or HTML content, local queue files, and downloaded attachment files] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Requires python3 plus EMAIL_ADDRESS and EMAIL_AUTH, or provider-specific EMAIL_* and EMAIL_*_AUTH environment variables.] <br>\n\n## Skill Version(s): <br>\n1.2.0 (source: server release metadata; artifact frontmatter lists 1.1.0) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.2.0:LICENSE.txt\n\nMIT License\n\nCopyright (c) 2026 Emailbox Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nArchive v1.1.0: 9 files, 27422 bytes\n\nFiles: LICENSE.txt (1077b), references/integrations.md (7286b), references/providers.md (7510b), references/templates.md (15167b), scripts/receive_mail.py (18532b), scripts/schedule_mail.py (19105b), scripts/send_mail.py (14904b), SKILL.md (12285b), _meta.json (127b)\n\nFile v1.1.0:SKILL.md\n\n---\nname: emailbox\ndescription: 职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachments, forwarding, data integration. 邮件收发、搜索、定时发送、附件、HTML模板、转发、文档数据联动。\nversion: 1.1.0\nlicense: MIT-0\nmetadata: {\"openclaw\": {\"emoji\": \"📬\", \"requires\": {\"bins\": [\"python3\"], \"env\": [\"EMAIL_ADDRESS\", \"EMAIL_AUTH\"]}, \"primaryEnv\": \"EMAIL_AUTH\"}}\n---\n\n# Emailbox - Professional Email Client & Data Integration\n\nIMAP/SMTP-based email toolkit supporting 12+ providers. Send, receive, search, forward, schedule emails with HTML templates, attachments, and document data integration.\n\n## Features\n\n- **Send**: Plain text, HTML, attachments, CC/BCC, reply, forward\n- **Receive**: List inbox, read emails, download attachments\n- **Search**: By keyword (subject/from/body), date range, sender\n- **Forward**: Fetch original email, forward to new recipients\n- **Schedule**: Send emails at a future time\n- **Templates**: 7 professional HTML email templates\n- **Integration**: Excel/OCR/PDF data → format → email\n- **Providers**: QQ, 163, 126, Sina, Outlook, Gmail, Yahoo, iCloud, Tencent Exmail, Ali Mail, Huawei, 139\n\n## Trigger\n\n- \"Send email to...\" / \"发邮件给...\"\n- \"Check inbox\" / \"查看收件箱\"\n- \"Reply to this email\" / \"回复这封邮件\"\n- \"Forward this email\" / \"转发这封邮件\"\n- \"Search emails from...\" / \"搜索...的邮件\"\n- \"Schedule email for...\" / \"定时发送...\"\n- \"Process data and email...\" / \"整理数据后发邮件\"\n- \"Attach this file...\" / \"添加附件...\"\n\n---\n\n## Step 0: Setup\n\n### Quick Start (Single Account)\n\n```bash\n# Set 2 environment variables and you're ready\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### Multi-Account Setup\n\n```bash\n# QQ Mail\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_auth_code\"\n\n# 163 Mail\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### Provider Auth Guide\n\nHow to get authorization codes for each provider → `references/providers.md`\n\n### Persistent Config\n\n```bash\n# Write to OpenClaw env\ncat >> ~/.openclaw/.env << 'EOF'\nEMAIL_ADDRESS=your@qq.com\nEMAIL_AUTH=your_auth_code\nEOF\n```\n\n---\n\n## Step 1: Send Email\n\n### Plain Text\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"recipient@example.com\" \\\n  --subject \"Project Update\" \\\n  --body \"Hi, here is the project update...\" \\\n  --provider qq\n```\n\n### Multiple Recipients + CC/BCC\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com,team@company.com\" \\\n  --cc \"hr@company.com\" \\\n  --bcc \"archive@company.com\" \\\n  --subject \"Weekly Report\" \\\n  --body \"Please find the weekly report attached.\" \\\n  --provider 163\n```\n\n### HTML Email (Use Templates)\n\nChoose a template from `references/templates.md`, fill in variables, save as HTML, then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"client@company.com\" \\\n  --subject \"Sales Report - 2026W16\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --provider outlook\n```\n\n### With Attachments\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"finance@company.com\" \\\n  --subject \"Invoice - FP20260418001\" \\\n  --body \"Please find the invoice attached.\" \\\n  --attach \"/path/to/invoice.jpg\" \"/path/to/detail.xlsx\" \\\n  --provider qq\n```\n\n### High Priority + Read Receipt\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"manager@company.com\" \\\n  --subject \"URGENT: Contract Review\" \\\n  --body \"Please review the attached contract ASAP.\" \\\n  --importance high \\\n  --receipt \\\n  --provider outlook\n```\n\n### Reply to Email\n\nFirst get the Message-ID from reading an email (Step 3), then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"sender@example.com\" \\\n  --subject \"Re: Original Subject\" \\\n  --body \"Got it, confirmed.\" \\\n  --reply-to \"<msgid@example.com>\" \\\n  --provider qq\n```\n\n### Forward Email\n\nFirst get the original email metadata (Step 4), then:\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"colleague@company.com\" \\\n  --subject \"Fwd: Original Subject\" \\\n  --body \"Please see the forwarded message below.\" \\\n  --forward-from \"Original Sender <sender@example.com>\" \\\n  --forward-date \"Mon, 18 Apr 2026 10:30:00 +0800\" \\\n  --forward-subject \"Original Subject\" \\\n  --forward-to \"me@company.com\" \\\n  --provider qq\n```\n\n---\n\n## Step 2: Receive Email\n\n### List Inbox (Recent Emails)\n\n```bash\npython3 scripts/receive_mail.py --list\npython3 scripts/receive_mail.py --list --count 20\npython3 scripts/receive_mail.py --list --provider gmail\npython3 scripts/receive_mail.py --list --folder \"Sent Items\"\n```\n\n### Read Email Content\n\n```bash\npython3 scripts/receive_mail.py --read 123 --provider qq\n```\n\n### Download Attachments\n\n```bash\npython3 scripts/receive_mail.py --read 123 --download-attachment 123 \\\n  --save-dir \"${OPENCLAW_WORKSPACE:-$PWD}/downloads\"\n```\n\n---\n\n## Step 3: Search Email\n\n```bash\n# Search by keyword (searches subject, from, AND body)\npython3 scripts/receive_mail.py --search \"contract\" --provider qq\n\n# Search by sender\npython3 scripts/receive_mail.py --search \"\" --from-filter \"zhangsan@company.com\"\n\n# Search by date range\npython3 scripts/receive_mail.py --search \"report\" --since \"2026-04-01\"\n\n# Combined search\npython3 scripts/receive_mail.py --search \"invoice\" --from-filter \"finance@company.com\" --since \"2026-04-01\" --count 5\n```\n\n### IMAP Folders\n\nAccess folders beyond INBOX:\n```bash\npython3 scripts/receive_mail.py --list --folder \"Sent Items\"\npython3 scripts/receive_mail.py --list --folder \"Drafts\"\npython3 scripts/receive_mail.py --list --folder \"Trash\"\n```\n\nCommon folder names:\n- Gmail: `[Gmail]/Sent Mail`, `[Gmail]/Drafts`, `[Gmail]/Spam`\n- QQ Mail: `Sent Messages`, `Drafts`, `Deleted Messages`\n- 163 Mail: `Sent`, `Drafts`, `Deleted`\n- Outlook: `SentItems`, `Drafts`, `Deleted`\n\n---\n\n## Step 4: Forward Email\n\n```bash\n# Step 1: Get original email metadata\npython3 scripts/receive_mail.py --forward 123 --provider qq\n\n# Output includes FORWARD_META with From/To/CC/Date/Subject/Message-ID\n\n# Step 2: Forward using the metadata\npython3 scripts/send_mail.py \\\n  --to \"colleague@company.com\" \\\n  --subject \"Fwd: Original Subject\" \\\n  --body \"FYI, please see below.\" \\\n  --forward-from \"Original Sender <sender@example.com>\" \\\n  --forward-date \"Mon, 18 Apr 2026 10:30:00 +0800\" \\\n  --forward-subject \"Original Subject\" \\\n  --forward-to \"me@company.com\" \\\n  --provider qq\n```\n\n---\n\n## Step 5: Document Data Integration\n\nCombine other Skills' output with email sending.\n\nDetailed workflows → `references/integrations.md`\n\n### Common Patterns\n\n```\n1. Excel → Email: Read data → HTML table → send\n2. OCR → Email: Recognize invoice → extract key info → send\n3. PDF → Email: Process PDF → summary + attachment → send\n4. Data Analysis → Email: Analyze data → conclusions → send\n5. Scheduled Report: Generate content → schedule → send\n```\n\n### Excel Data → Email Example\n\n```bash\n# Step 1: Read and format data (use excel-studio or python3)\n# Step 2: Save HTML content using a template from references/templates.md\n# Step 3: Send\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com\" \\\n  --subject \"Sales Report $(date +%Y%m%d)\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --attach \"/path/to/report.xlsx\" \\\n  --provider qq\n```\n\n### Related Skills\n\n| Skill | Integration | Scenario |\n|-------|------------|----------|\n| china-doc-ocr | OCR → email content | Invoice/contract recognition then email |\n| excel-studio | Excel → table email | Data reports, financial statements |\n| pdf-studio | PDF → email attachment | PDF report sending |\n| data-analyzer | Analysis → email conclusions | Data insight notifications |\n\n---\n\n## Step 6: Schedule Email\n\n### Send at Specific Time\n\n```bash\npython3 scripts/schedule_mail.py \\\n  --schedule --at \"2026-04-19 09:00\" \\\n  --to \"boss@company.com\" \\\n  --subject \"Daily Report - 2026-04-19\" \\\n  --body \"Today's work summary...\" \\\n  --provider qq\n```\n\n### Send in N Minutes\n\n```bash\npython3 scripts/schedule_mail.py \\\n  --schedule --in 30 \\\n  --to \"client@example.com\" \\\n  --subject \"Follow up\" \\\n  --body \"Following up on our meeting...\" \\\n  --provider 163\n```\n\n### Manage Scheduled Emails\n\n```bash\n# View scheduled emails\npython3 scripts/schedule_mail.py --list-scheduled\n\n# Cancel a scheduled email\npython3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n# Manually process due emails\npython3 scripts/schedule_mail.py --process-queue\n```\n\n### Auto-Processing (Recommended)\n\n```bash\n# Add to crontab for 1-minute interval processing\n(crontab -l 2>/dev/null; echo \"* * * * * python3 $(pwd)/scripts/schedule_mail.py --process-queue\") | crontab -\n```\n\n---\n\n## Step 7: HTML Email Templates\n\n7 professional templates available → `references/templates.md`\n\n| Template | Use Case |\n|----------|----------|\n| Business Report | Data reports, financial summaries |\n| Meeting Invitation | Meetings, events, interviews |\n| Notification / Announcement | Company announcements, system alerts |\n| Thank You Letter | Appreciation, follow-ups |\n| Weekly/Daily Report | Work progress updates |\n| Invoice Notification | Invoice/receipt processing |\n| Formal Letter | Official correspondence |\n\n---\n\n## Provider Configuration\n\n12+ providers with IMAP/SMTP config and auth code guides → `references/providers.md`\n\n| Provider | IMAP | SMTP | Port | Auth | China |\n|----------|------|------|------|------|-------|\n| QQ Mail | imap.qq.com | smtp.qq.com | 465 | Authorization code | Yes |\n| 163 Mail | imap.163.com | smtp.163.com | 465 | Client password | Yes |\n| 126 Mail | imap.126.com | smtp.126.com | 465 | Client password | Yes |\n| Sina | imap.sina.com | smtp.sina.com | 465 | Enable IMAP | Yes |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | App password | Yes |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | App password | VPN |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | App password | VPN |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | App password | VPN |\n| Tencent Exmail | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | Enable IMAP | Yes |\n| Ali Mail | imap.mxhichina.com | smtp.mxhichina.com | 465 | Enable IMAP | Yes |\n| Huawei | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | App password | Yes |\n| 139 Mail | imap.mail.139.com | smtp.mail.139.com | 465 | Enable IMAP | Yes |\n\n---\n\n## Error Handling\n\n```\nError                              → Solution\n──────────────────────────────────────────────────────────\nSMTP auth failed                   → Check authorization code, see providers.md\nIMAP connection failed             → Verify IMAP enabled, check network\nConnection timeout                 → Gmail/Yahoo/iCloud need VPN in China\nSMTP auth code error (QQ/163)     → Use authorization code, NOT login password\nSending rate limit                 → QQ: 1/min, 500/day; 163: 200/day; Gmail: 500/day\nAttachment too large               → QQ: 50MB; Gmail: 25MB; Outlook: 20MB\nIMAP not enabled                   → Enable in email settings, see providers.md\n163 requires phone verification    → Verify via SMS, wait 5-10 minutes\n```\n\n---\n\n## Privacy & Security\n\n- Direct IMAP/SMTP connection to email servers, no third-party data transfer\n- Authorization codes stored in environment variables, not in files\n- Authorization codes are email-specific, cannot be used to log into webmail\n- Recommend using dedicated authorization codes (not main passwords)\n- Schedule queue stored in `~/.emailbox/queue/`, clean up sensitive data promptly\n\n## Notes\n\n- Requires IMAP/SMTP service enabled and authorization code configured\n- Gmail/Yahoo/iCloud require VPN in mainland China\n- QQ Mail limits: 500 emails/day, 1 email/minute\n- 163/126 Mail limits: 200 emails/day\n- Attachment size limits vary by provider (QQ: 50MB, Gmail: 25MB, Outlook: 20MB)\n- Scheduled sending depends on system scheduler (crontab)\n\nFile v1.1.0:_meta.json\n\n{\n  \"ownerId\": \"kn75z6gevjsyrznm7dg2ez6sen82h8sz\",\n  \"slug\": \"emailbox\",\n  \"version\": \"1.1.0\",\n  \"publishedAt\": 1776528274517\n}\n\nFile v1.1.0:references/integrations.md\n\n# 文档数据联动 Document Integration\n\n邮件与文档数据处理的一体化工作流。结合其他 Skills 的能力，实现\"数据处理 → 格式化 → 邮件发送\"的自动化。\n\n---\n\n## 场景总览\n\n| 场景 | 数据来源 | 邮件输出 | 关联 Skill |\n|------|----------|----------|-----------|\n| Excel 报表发送 | .xlsx/.csv 数据 | HTML 表格 + 附件 | excel-studio |\n| 发票识别+邮件 | 图片/PDF 发票 | 结构化摘要 + 附件 | china-doc-ocr |\n| 合同审核+邮件 | 合同 PDF | 审核要点 + 附件 | china-doc-ocr, china-legal-analysis |\n| PDF 报告发送 | PDF 文件 | 摘要 + 附件 | pdf-studio |\n| 简历解析+邮件 | 简历 PDF/Word | 候选人摘要 + 附件 | china-doc-ocr |\n| 数据分析+邮件 | 原始数据 | 分析结论 + 图表 | data-analyzer |\n\n---\n\n## 工作流模板\n\n### 流程 1：Excel 数据 → 格式化邮件\n\n```\n用户请求：\"把这个 Excel 的销售数据做成表格发邮件给老板\"\n↓\nStep 1: 读取 Excel 文件\n  → 使用 excel-studio 读取数据\n  → 或使用 python3 + openpyxl 直接读取\n↓\nStep 2: 数据处理与格式化\n  → 提取关键指标（总计、变化、排名等）\n  → 生成 HTML 表格（使用 templates.md 中商务报告模板）\n  → 生成纯文本摘要（作为 fallback）\n↓\nStep 3: 生成邮件内容并保存\n  → 将 HTML 保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.html\n  → 将纯文本保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.txt\n↓\nStep 4: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to boss@company.com \\\n    --subject \"销售数据周报 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/sales_data.xlsx \\\n    --provider qq\n```\n\n### 流程 2：OCR 识别 → 邮件通知\n\n```\n用户请求：\"识别这张发票，把结果发邮件给财务\"\n↓\nStep 1: OCR 识别\n  → 使用 china-doc-ocr 识别发票图片/PDF\n  → 提取关键字段：发票号码、金额、日期、购方/销方信息\n↓\nStep 2: 格式化邮件内容\n  → 使用 templates.md 中的发票通知模板\n  → 填入识别出的字段数据\n  → 生成纯文本摘要\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to finance@company.com \\\n    --subject \"发票处理 - ${invoice_number}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/invoice.jpg \\\n    --provider 163\n```\n\n### 流程 3：合同审核 → 邮件汇报\n\n```\n用户请求：\"审核这份合同后把要点发邮件给法务\"\n↓\nStep 1: 识别合同\n  → 使用 china-doc-ocr 识别合同文本\n↓\nStep 2: 法律分析\n  → 使用 china-legal-analysis 分析合同条款\n  → 提取风险点和审核意见\n↓\nStep 3: 格式化并发送\n  python3 scripts/send_mail.py \\\n    --to legal@company.com \\\n    --subject \"合同审核报告 - ${contract_name}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/contract.pdf \\\n    --importance high \\\n    --provider qq\n```\n\n### 流程 4：简历解析 → 转发 HR\n\n```\n用户请求：\"解析这份简历然后转发给HR\"\n↓\nStep 1: 识别简历\n  → 使用 china-doc-ocr 识别简历 PDF/图片\n↓\nStep 2: 结构化提取\n  → 提取姓名、学历、工作经验、技能等\n  → 生成候选人摘要卡片\n↓\nStep 3: 转发邮件\n  python3 scripts/send_mail.py \\\n    --to hr@company.com \\\n    --subject \"候选人推荐 - ${candidate_name} - ${position}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/resume.pdf\n```\n\n### 流程 5：数据分析 → 邮件报告\n\n```\n用户请求：\"分析这份数据后发邮件给团队\"\n↓\nStep 1: 读取和数据\n  → 使用 data-analyzer 或 python3 分析 CSV/Excel\n↓\nStep 2: 生成分析报告\n  → 关键指标、趋势、异常值\n  → 生成 HTML 报告格式\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to \"team1@company.com,team2@company.com\" \\\n    --subject \"数据分析报告 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/data.xlsx\n```\n\n### 流程 6：定时日报/周报\n\n```\n用户请求：\"每天早上9点自动发日报给老板\"\n↓\nStep 1: 收集日报内容\n  → 用户或 AI 生成日报内容\n  → 保存为 HTML 文件\n↓\nStep 2: 设置定时发送\n  python3 scripts/schedule_mail.py \\\n    --schedule \\\n    --at \"2026-04-19 09:00\" \\\n    --to boss@company.com \\\n    --subject \"工作日报 - $(date +%Y-%m-%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --provider qq\n↓\nStep 3: 管理定时任务\n  # 查看已安排的定时邮件\n  python3 scripts/schedule_mail.py --list-scheduled\n\n  # 取消定时邮件\n  python3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n  # 手动处理到期队列\n  python3 scripts/schedule_mail.py --process-queue\n```\n\n---\n\n## 数据格式转换速查\n\n### 从 Excel 生成 HTML 表格\n\n```python\nimport json\n\n# 假设从 Excel 读取的数据格式\ndata = [\n    [\"指标\", \"本周\", \"上周\", \"变化\"],\n    [\"营收\", \"¥128万\", \"¥115万\", \"↑11.3%\"],\n    [\"用户数\", \"12,345\", \"11,890\", \"↑3.8%\"],\n    [\"转化率\", \"3.2%\", \"2.9%\", \"↑0.3pp\"],\n]\n\n# 生成 HTML 表格行\ntable_rows = \"\"\nfor i, row in enumerate(data):\n    if i == 0:\n        continue  # 跳过表头（模板已有）\n    color = \"#27ae60\" if \"↑\" in row[3] else \"#e74c3c\"\n    table_rows += f'<tr style=\"border-bottom:1px solid #eee;\">'\n    for j, cell in enumerate(row):\n        align = \"text-align:right\" if j > 0 else \"\"\n        font = \"font-weight:bold\" if j == 3 else \"\"\n        row_color = f'color:{color}' if j == 3 else \"\"\n        table_rows += f'<td style=\"padding:10px 16px;font-size:14px;{align};{font};{row_color};\">{cell}</td>'\n    table_rows += '</tr>\\n'\n```\n\n### 从 OCR 结果生成邮件内容\n\n```python\n# OCR 识别结果（从 china-doc-ocr 获取）\nocr_result = {\n    \"invoice_number\": \"12345678\",\n    \"amount\": \"¥5,280.00\",\n    \"date\": \"2026年4月18日\",\n    \"seller\": \"XX科技有限公司\",\n    \"buyer\": \"YY集团有限公司\",\n}\n\n# 生成摘要文本\nsummary = f\"\"\"发票识别结果：\n发票号码：{ocr_result['invoice_number']}\n开票日期：{ocr_result['date']}\n金额：{ocr_result['amount']}\n销售方：{ocr_result['seller']}\n购买方：{ocr_result['buyer']}\n\"\"\"\n```\n\n---\n\n## 与 Skills 联动清单\n\n| Skill | 联动方式 | 典型场景 |\n|-------|----------|----------|\n| china-doc-ocr | OCR 识别 → 邮件内容 | 发票、合同、证件识别后邮件发送 |\n| excel-studio | 读取 Excel → 表格邮件 | 数据报表、财务报告 |\n| pdf-studio | PDF 处理 → 邮件附件 | PDF 报告发送 |\n| data-analyzer | 数据分析 → 结论邮件 | 数据洞察通知 |\n| china-legal-analysis | 合同审核 → 邮件通知 | 合同风险点邮件通知 |\n| interview-pro | 面试反馈 → 邮件通知 | 候选人评估结果邮件 |\n\nFile v1.1.0:references/providers.md\n\n# 邮箱服务商配置 Email Provider Configuration\n\n## 12+ 服务商 IMAP/SMTP 配置\n\n| 服务商 | IMAP 服务器 | SMTP 服务器 | SMTP 端口 | SSL | 环境变量 |\n|--------|-------------|-------------|----------|-----|----------|\n| QQ 邮箱 | imap.qq.com | smtp.qq.com | 465 | SSL | EMAIL_QQ / EMAIL_QQ_AUTH |\n| 163 邮箱 | imap.163.com | smtp.163.com | 465 | SSL | EMAIL_163 / EMAIL_163_AUTH |\n| 126 邮箱 | imap.126.com | smtp.126.com | 465 | SSL | EMAIL_126 / EMAIL_126_AUTH |\n| 新浪邮箱 | imap.sina.com | smtp.sina.com | 465 | SSL | EMAIL_SINA / EMAIL_SINA_AUTH |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | STARTTLS | EMAIL_OUTLOOK / EMAIL_OUTLOOK_AUTH |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | STARTTLS | EMAIL_GMAIL / EMAIL_GMAIL_AUTH |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | STARTTLS | EMAIL_YAHOO / EMAIL_YAHOO_AUTH |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | STARTTLS | EMAIL_ICLOUD / EMAIL_ICLOUD_AUTH |\n| 腾讯企业邮箱 | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | SSL | EMAIL_EXMAIL / EMAIL_EXMAIL_AUTH |\n| 阿里企业邮箱 | imap.mxhichina.com | smtp.mxhichina.com | 465 | SSL | EMAIL_ALIMAIL / EMAIL_ALIMAIL_AUTH |\n| 华为邮箱 | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | SSL | EMAIL_HUAWEI / EMAIL_HUAWEI_AUTH |\n| 139 邮箱 | imap.mail.139.com | smtp.mail.139.com | 465 | SSL | EMAIL_139 / EMAIL_139_AUTH |\n\n---\n\n## 环境变量配置\n\n### 单账号模式（推荐新手）\n\n最简配置，只需 2 个环境变量：\n\n```bash\nexport EMAIL_ADDRESS=\"your@email.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### 多账号模式（支持多个邮箱）\n\n每个邮箱单独配置：\n\n```bash\n# QQ 邮箱\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_authorization_code\"\n\n# 163 邮箱\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Outlook\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"outlook_app_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### 优先级规则\n\n1. 命令行指定 `--from-addr` 和 `--provider` 最高优先\n2. 对应服务商的环境变量（如 `EMAIL_QQ` / `EMAIL_QQ_AUTH`）\n3. 通用环境变量 `EMAIL_ADDRESS` / `EMAIL_AUTH`\n\n---\n\n## Authorization Code Setup / 授权码获取教程\n\n### QQ Mail / QQ 邮箱\n\n1. Log in to QQ Mail (mail.qq.com) → Settings (设置) → Account (账号)\n2. Find \"POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV Service\"\n3. Enable IMAP/SMTP service\n4. Click \"Generate Authorization Code\" (生成授权码)\n5. Follow prompts to send SMS verification from your phone\n6. Receive 16-character authorization code (no spaces)\n\n```bash\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"abcdefghijklmnop\"\n```\n\n**Note:** QQ Mail authorization code is 16 letters, NOT your QQ password.\n\n### 163 Mail / 163 邮箱\n\n1. Log in to 163 Mail (mail.163.com) → Settings (设置) → POP3/SMTP/IMAP\n2. Enable \"IMAP/SMTP Service\"\n3. Click \"Client Authorization Password\" (客户端授权密码)\n4. Verify via SMS, then set the authorization password\n\n```bash\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"your_client_password\"\n```\n\n**Note:** 163 Mail requires authorization password, NOT your login password.\n\n### 126 Mail / 126 邮箱\n\n1. Log in to 126 Mail (mail.126.com) → Settings → POP3/SMTP/IMAP\n2. Enable IMAP service\n3. Set client authorization password\n\n```bash\nexport EMAIL_126=\"your@126.com\"\nexport EMAIL_126_AUTH=\"your_client_password\"\n```\n\n### Sina Mail / 新浪邮箱\n\n1. Log in to Sina Mail (mail.sina.com) → Settings → Client Settings\n2. Enable IMAP/SMTP service\n3. 部分账号需要通过手机验证\n\n```bash\nexport EMAIL_SINA=\"your@sina.com\"\nexport EMAIL_SINA_AUTH=\"your_password\"\n```\n\n### Outlook / Hotmail\n\n1. Visit https://account.microsoft.com/security\n2. Advanced security options → App passwords\n3. Generate a new app password\n\n```bash\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"your_app_password\"\n```\n\n**Note:** If two-step verification is enabled, you MUST use an app password, not your login password. Microsoft is deprecating basic auth — OAuth2 Modern Auth may be required in the future.\n\n### Gmail\n\n1. Enable two-step verification: https://myaccount.google.com/security\n2. Create an app password: https://myaccount.google.com/apppasswords\n3. Select \"Mail\" and device, generate the 16-character password\n4. **Google removed \"Less Secure Apps\" access in 2022** — only App Passwords work now\n\n```bash\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"abcd efgh ijkl mnop\"\n```\n\n**Note:** Gmail app passwords may contain spaces; no need to remove them. Requires VPN in mainland China.\n\n### Yahoo Mail\n\n1. Log in to Yahoo → Account Security → Generate app password\n2. Yahoo no longer supports \"Less Secure Apps\" — app password is required\n\n```bash\nexport EMAIL_YAHOO=\"your@yahoo.com\"\nexport EMAIL_YAHOO_AUTH=\"your_app_password\"\n```\n\n**Note:** Requires VPN in mainland China.\n\n### iCloud Mail\n\n1. Apple ID → Account Settings → App-Specific Passwords\n2. Generate a password\n\n```bash\nexport EMAIL_ICLOUD=\"your@icloud.com\"\nexport EMAIL_ICLOUD_AUTH=\"your_app_specific_password\"\n```\n\n**Note:** Requires VPN in mainland China.\n\n### Tencent Exmail / 腾讯企业邮箱\n\n1. Log in to enterprise mail (exmail.qq.com) → Settings → Client Settings\n2. Confirm IMAP service is enabled\n3. Use enterprise email password or authorization code\n\n```bash\nexport EMAIL_EXMAIL=\"your@company.com\"\nexport EMAIL_EXMAIL_AUTH=\"your_password\"\n```\n\n### Ali Mail / 阿里企业邮箱\n\n1. Log in to Ali Mail (mail.mxhichina.com) → Settings → POP/IMAP Settings\n2. Enable IMAP service\n\n```bash\nexport EMAIL_ALIMAIL=\"your@company.com\"\nexport EMAIL_ALIMAIL_AUTH=\"your_password\"\n```\n\n### Huawei Mail / 华为邮箱\n\n1. Log in to Huawei Mail (mail.hicloud.com) → Settings → Account Security\n2. Generate app password\n\n```bash\nexport EMAIL_HUAWEI=\"your@hicloud.com\"\nexport EMAIL_HUAWEI_AUTH=\"your_app_password\"\n```\n\n### 139 Mail / 139 邮箱 (China Mobile)\n\n1. Log in to 139 Mail (mail.139.com) → Settings → Account\n2. Enable IMAP service\n\n```bash\nexport EMAIL_139=\"your@139.com\"\nexport EMAIL_139_AUTH=\"your_password\"\n```\n\n---\n\n## Common Issues / 常见问题\n\n### SMTP Authentication Failed / SMTP 认证失败\n\n- Check that you're using the authorization code, NOT your login password\n- Make sure IMAP/SMTP service is enabled in your email settings\n- QQ/163: You must explicitly enable IMAP service in email settings\n\n### Connection Timeout / 连接超时\n\n- Gmail/Yahoo/iCloud: Requires VPN in mainland China (国内需翻墙)\n- Check if firewall blocks ports 465/587/993\n- Try SSL (port 465) or STARTTLS (port 587) alternatively\n\n### 163 Requires Phone Verification / 163 邮箱提示需要手机验证\n\n- New IMAP enablement on 163 may require SMS verification\n- Wait 5-10 minutes after verification before trying again\n\n### Sending Rate Limits / 发送频率限制\n\n| Service | Daily Limit / 每日上限 |\n|---------|----------------------|\n| QQ Mail | 500 emails/day, 1 email/minute |\n| 163/126 Mail | 200 emails/day |\n| Gmail | 500 emails/day |\n| Outlook | 300 emails/day |\n| Yahoo | 500 emails/day |\n\n### Attachment Size Limits / 附件大小限制\n\n| Service | Attachment Limit / 附件上限 |\n|---------|---------------------------|\n| QQ Mail | 50MB |\n| 163/126 Mail | 50MB |\n| Gmail | 25MB |\n| Outlook | 20MB |\n| Yahoo | 25MB |\n| iCloud | 20MB |\n\nFile v1.1.0:references/templates.md\n\n# HTML 邮件模板 HTML Email Templates\n\n专业邮件 HTML 模板，支持中英文场景。使用时将占位符 `{变量名}` 替换为实际内容。\n\n---\n\n## 1. 商务报告模板 Business Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1a5276,#2e86c1);padding:30px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:22px;\">{report_title}</h1>\n<p style=\"margin:8px 0 0;font-size:14px;opacity:0.9;\">{report_period} | {report_date}</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{summary}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:20px 0;\">\n<thead><tr style=\"background:#eaf2f8;\">\n<th style=\"padding:12px 16px;text-align:left;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col1_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col2_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col3_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col4_header}</th>\n</tr></thead>\n<tbody>\n{table_rows}\n</tbody>\n</table>\n<p style=\"margin:20px 0 0;font-size:14px;color:#555;line-height:1.8;\">{detail_text}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:20px 40px;border-top:1px solid #eee;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {sender_department}<br>\n此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n**表格行模板：**\n```html\n<tr style=\"border-bottom:1px solid #eee;\">\n<td style=\"padding:10px 16px;font-size:14px;color:#333;\">{col1_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col2_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col3_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;font-weight:bold;color:{positive_color};\">{col4_value}</td>\n</tr>\n```\n\n---\n\n## 2. 会议邀请模板 Meeting Invitation\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#6c3483,#a569bd);padding:35px 40px;color:#ffffff;text-align:center;\">\n<h1 style=\"margin:0;font-size:24px;\">{event_title}</h1>\n<p style=\"margin:10px 0 0;font-size:16px;opacity:0.9;\">诚挚邀请您参加</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin:0 0 25px;\">\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;width:80px;\">🕐 时间</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_time}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">📍 地点</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_location}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">👤 主持人</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{event_host}</td></tr>\n<tr><td style=\"padding:8px 0;font-size:14px;color:#888;\">📋 会议号</td><td style=\"padding:8px 0;font-size:15px;color:#333;font-weight:bold;\">{meeting_id}</td></tr>\n</table>\n<p style=\"margin:0 0 5px;font-size:14px;color:#333;font-weight:bold;\">会议议程：</p>\n<ol style=\"margin:5px 0 20px;padding-left:20px;font-size:14px;color:#555;line-height:2;\">\n{agenda_items}\n</ol>\n<p style=\"margin:0 0 5px;font-size:14px;color:#333;font-weight:bold;\">参会要求：</p>\n<ul style=\"margin:5px 0 20px;padding-left:20px;font-size:13px;color:#666;line-height:1.8;\">\n{requirements}\n</ul>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>\n<td align=\"center\" style=\"padding:10px;\"><a href=\"{accept_url}\" style=\"display:inline-block;padding:12px 30px;background:#27ae60;color:#ffffff;text-decoration:none;border-radius:5px;font-size:14px;font-weight:bold;\">✅ 接受邀请</a></td>\n<td align=\"center\" style=\"padding:10px;\"><a href=\"{decline_url}\" style=\"display:inline-block;padding:12px 30px;background:#e74c3c;color:#ffffff;text-decoration:none;border-radius:5px;font-size:14px;font-weight:bold;\">❌ 无法参加</a></td>\n</tr></table>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | 联系方式：{contact_info}\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 3. 通知公告模板 Notification / Announcement\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:#c0392b;padding:6px 40px;text-align:center;\">\n<span style=\"color:#ffffff;font-size:12px;font-weight:bold;letter-spacing:2px;\">🔴 重要通知 IMPORTANT NOTICE</span>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<h2 style=\"margin:0 0 5px;font-size:20px;color:#c0392b;\">{notice_title}</h2>\n<p style=\"margin:0 0 20px;font-size:13px;color:#999;\">发布时间：{notice_date} | 发布人：{notice_author}</p>\n<div style=\"padding:20px;background:#fdf2f2;border-left:4px solid #c0392b;margin:0 0 20px;font-size:14px;color:#333;line-height:1.8;\">\n{notice_summary}\n</div>\n<p style=\"margin:0 0 20px;font-size:14px;color:#333;line-height:1.8;\">{notice_detail}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f8f9fa;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:13px;color:#555;line-height:1.8;\">\n<strong>⚠️ 注意事项：</strong><br>\n{notice_action_items}\n</td></tr>\n</table>\n<p style=\"margin:0;font-size:14px;color:#555;\">如有疑问，请联系：{contact_info}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_department} | 此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 4. 感谢信模板 Thank You Letter\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#f39c12,#e67e22);padding:35px 40px;color:#ffffff;text-align:center;\">\n<h1 style=\"margin:0;font-size:28px;\">🙏 感谢您</h1>\n<p style=\"margin:10px 0 0;font-size:16px;opacity:0.9;\">Thank You</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">亲爱的 {recipient_name}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{thank_message}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fef9e7;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:14px;color:#7d6608;text-align:center;font-style:italic;line-height:1.6;\">\n\"{quote_text}\"\n</td></tr>\n</table>\n<p style=\"margin:0 0 10px;font-size:14px;color:#555;line-height:1.8;\">{additional_message}</p>\n<p style=\"margin:20px 0 0;font-size:15px;color:#333;\">此致<br>敬礼</p>\n<p style=\"margin:5px 0 0;font-size:14px;color:#666;\">{sender_name}<br>{sender_title}</p>\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 5. 周报/日报模板 Weekly/Daily Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1abc9c,#16a085);padding:25px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:20px;\">📋 {report_type}周报</h1>\n<p style=\"margin:5px 0 0;font-size:13px;opacity:0.9;\">{reporter_name} | {report_period}</p>\n</td></tr>\n<tr><td style=\"padding:25px 40px;\">\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#1abc9c;\">✅ 本周完成</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{completed_items}\n</ul>\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#e67e22;\">🔄 进行中</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{in_progress_items}\n</ul>\n<h3 style=\"margin:0 0 15px;font-size:16px;color:#3498db;\">📋 下周计划</h3>\n<ul style=\"margin:0 0 20px;padding-left:20px;font-size:14px;color:#333;line-height:2;\">\n{next_week_items}\n</ul>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fef9e7;border-radius:6px;margin:0 0 20px;\">\n<tr><td style=\"padding:15px 20px;font-size:14px;color:#7d6608;\">\n<strong>⚠️ 需协调事项：</strong>{blocker_items}\n</td></tr>\n</table>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {department} | {date}\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 6. 发票/单据通知模板 Invoice Notification\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#2c3e50,#34495e);padding:25px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:20px;\">📄 {document_type}通知</h1>\n<p style=\"margin:5px 0 0;font-size:13px;opacity:0.9;\">单据编号：{document_id}</p>\n</td></tr>\n<tr><td style=\"padding:25px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{document_description}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:0 0 20px;\">\n<tr style=\"background:#2c3e50;\"><td style=\"padding:10px 16px;color:#ffffff;font-size:13px;font-weight:bold;\">项目</td><td style=\"padding:10px 16px;color:#ffffff;font-size:13px;font-weight:bold;text-align:right;\">详情</td></tr>\n{document_rows}\n<tr style=\"background:#eaf2f8;border-top:2px solid #2c3e50;\"><td style=\"padding:10px 16px;font-size:14px;font-weight:bold;color:#2c3e50;\">合计</td><td style=\"padding:10px 16px;font-size:14px;font-weight:bold;color:#2c3e50;text-align:right;\">{total_amount}</td></tr>\n</table>\n<p style=\"margin:0 0 10px;font-size:13px;color:#999;\">📎 附件：{attachment_info}</p>\n<p style=\"margin:0 0 10px;font-size:13px;color:#999;\">⏰ 截止日期：{deadline}</p>\n<p style=\"margin:10px 0 0;font-size:14px;color:#555;\">如有疑问，请联系 {contact_person}（{contact_info}）</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:15px 40px;font-size:12px;color:#999;text-align:center;\">\n{sender_department} | 此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 7. 正式信函模板 Formal Letter\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"padding:40px;\">\n<p style=\"margin:0 0 5px;font-size:14px;color:#666;\">{sender_address}</p>\n<p style=\"margin:0 0 20px;font-size:13px;color:#999;\">{send_date}</p>\n<p style=\"margin:0 0 5px;font-size:15px;color:#333;\">{recipient_title} {recipient_name}</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#666;\">{recipient_address}</p>\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{subject_line}</p>\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{salutation}，</p>\n<div style=\"font-size:14px;color:#333;line-height:2;\">{letter_body}</div>\n<p style=\"margin:30px 0 5px;font-size:15px;color:#333;\">此致<br>敬礼</p>\n<p style=\"margin:20px 0 0;font-size:14px;color:#333;\">{sender_name}</p>\n<p style=\"margin:0;font-size:13px;color:#666;\">{sender_title}</p>\n<p style=\"margin:0;font-size:13px;color:#666;\">{sender_organization}</p>\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n---\n\n## 使用说明\n\n1. 选择合适的模板\n2. 将 `{变量名}` 替换为实际内容\n3. 将替换后的 HTML 保存为文件，例如 `${OPENCLAW_WORKSPACE}/.emailbox_body.html`\n4. 使用 `--html-file` 参数发送：\n\n```bash\npython3 scripts/send_mail.py \\\n  --to recipient@example.com \\\n  --subject \"周报 - 张三 - 2026年第16周\" \\\n  --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n  --provider qq\n```\n\nFile v1.1.0:LICENSE.txt\n\nMIT License\n\nCopyright (c) 2026 Emailbox Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nArchive v1.0.0: 9 files, 26219 bytes\n\nFiles: LICENSE.txt (1077b), references/integrations.md (7286b), references/providers.md (6385b), references/templates.md (15167b), scripts/receive_mail.py (17684b), scripts/schedule_mail.py (15346b), scripts/send_mail.py (13974b), SKILL.md (11970b), _meta.json (127b)\n\nFile v1.0.0:SKILL.md\n\n---\nname: emailbox\ndescription: 邮件收发与数据处理一体化专业工具。支持12+邮箱服务商(Gmail/Outlook/QQ/163/126/Yahoo/iCloud等)的IMAP收邮件、SMTP发邮件、HTML邮件模板、附件发送、邮件搜索、定时发送、文档数据联动。Use when user needs to send or receive emails, schedule emails, attach files, search inbox, or process documents and email results. 邮件收发、邮箱管理、定时发送、附件、HTML邮件、数据联动。\nversion: 1.0.0\nlicense: MIT-0\nmetadata: {\"openclaw\": {\"emoji\": \"📬\", \"requires\": {\"bins\": [\"python3\"], \"env\": [\"EMAIL_ADDRESS\", \"EMAIL_AUTH\"]}, \"primaryEnv\": \"EMAIL_AUTH\"}}\n---\n\n# Emailbox 邮件收发与数据处理一体化工具\n\nIMAP/SMTP 协议直连 12+ 邮箱服务商，收发邮件、HTML 模板、附件、定时发送、文档数据联动。\n\n## 核心能力\n\n- 📤 **发送邮件**：纯文本 / HTML / 附件 / 多收件人 / 抄送密送\n- 📥 **收取邮件**：IMAP 读取收件箱、查看邮件内容、下载附件\n- 📎 **附件支持**：发送任意类型附件（文档、表格、图片等）\n- 📊 **数据联动**：Excel/OCR/PDF 等数据处理后自动发邮件\n- 🎨 **HTML 模板**：7 种专业邮件模板（商务报告/邀请函/通知/感谢信等）\n- 🔍 **邮件搜索**：按关键词、发件人、日期搜索邮件\n- 🔄 **回复/转发**：基于 Message-ID 的标准回复和转发\n- ⏰ **定时发送**：指定时间发送邮件\n- 🌍 **12+ 服务商**：QQ/163/126/新浪/Gmail/Outlook/Yahoo/iCloud/企业邮箱/华为/139\n\n## 触发时机\n\n- \"发邮件给XXX\" / \"Send an email\"\n- \"查看收件箱\" / \"Check my inbox\"\n- \"回复这封邮件\" / \"Reply to this email\"\n- \"把这个报告邮件发给XXX\" / \"Email this report\"\n- \"识别这个发票后发邮件给财务\" / \"OCR then email\"\n- \"搜索XXX的邮件\" / \"Find emails\"\n- \"明早9点发邮件\" / \"Schedule email\"\n- \"把数据整理后发邮件\" / \"Process and email\"\n\n---\n\n## Step 0：环境配置\n\n### 首次使用需要配置邮箱授权码\n\n各服务商授权码获取方法 → `references/providers.md`\n\n### 最简配置（单账号）\n\n```bash\n# 设置默认邮箱（只需 2 个环境变量）\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### 多账号配置\n\n```bash\n# QQ 邮箱\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_auth_code\"\n\n# 163 邮箱\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_auth_code\"\n\n# Outlook\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"outlook_app_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### 写入持久化配置\n\n```bash\n# 写入 OpenClaw 环境变量（推荐）\ncat >> ~/.openclaw/.env << 'EOF'\nEMAIL_ADDRESS=your@qq.com\nEMAIL_AUTH=your_auth_code\nEOF\n\n# 或多账号\ncat >> ~/.openclaw/.env << 'EOF'\nEMAIL_QQ=your@qq.com\nEMAIL_QQ_AUTH=your_qq_auth\nEMAIL_163=your@163.com\nEMAIL_163_AUTH=your_163_auth\nEOF\n```\n\n---\n\n## Step 1：理解用户意图\n\n```\n用户请求 → 判断操作类型：\n\n\"发邮件/发送\"           → 发送邮件（Step 2）\n\"收邮件/查看/收件箱\"     → 收取邮件（Step 3）\n\"回复\"                 → 回复邮件（Step 4）\n\"搜索/查找\"             → 搜索邮件（Step 5）\n\"整理数据后发邮件\"       → 文档联动（Step 6）\n\"定时发送/安排\"          → 定时发送（Step 7）\n\"下载附件\"              → 下载附件（Step 3 扩展）\n```\n\n收集必要信息：\n- 收件人 / 发件人邮箱地址\n- 邮件主题\n- 邮件内容要点\n- 是否需要 HTML 模板\n- 是否需要附件\n- 语言和语气偏好\n\n---\n\n## Step 2：发送邮件\n\n### 2.1 纯文本邮件\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"recipient@example.com\" \\\n  --subject \"项目进度更新\" \\\n  --body \"您好，本周项目进度如下：1. 完成了前端开发 2. 后端接口已联调 3. 测试中和再\" \\\n  --provider qq\n```\n\n### 2.2 多收件人 + 抄送密送\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com,manager@company.com\" \\\n  --cc \"team@company.com\" \\\n  --bcc \"archive@company.com\" \\\n  --subject \"周报 - 2026第16周\" \\\n  --body \"详见附件\" \\\n  --provider qq\n```\n\n### 2.3 HTML 邮件（使用模板）\n\n先从 `references/templates.md` 选择模板，填充变量，保存为 HTML 文件：\n\n```bash\n# 邮件内容保存到工作区\ncat > \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" << 'EOF'\n(使用模板生成的 HTML 内容)\nEOF\n\n# 发送 HTML 邮件\npython3 scripts/send_mail.py \\\n  --to \"recipient@example.com\" \\\n  --subject \"销售数据周报 - 2026W16\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --provider 163\n```\n\nHTML 模板选择 → `references/templates.md`\n\n### 2.4 带附件发送\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"finance@company.com\" \\\n  --subject \"发票处理 - FP20260418001\" \\\n  --body \"请查收发票原件\" \\\n  --attach \"/path/to/invoice.jpg\" \"/path/to/invoice_detail.xlsx\" \\\n  --provider qq\n```\n\n### 2.5 指定服务商\n\n```bash\n# 自动检测（根据发件人邮箱后缀）\npython3 scripts/send_mail.py --to ... --from-addr \"me@qq.com\" ...\n\n# 强制指定服务商\npython3 scripts/send_mail.py --to ... --provider gmail ...\n# 支持: qq 163 126 sina outlook gmail yahoo icloud exmail mxhichina hicloud 139\n```\n\n---\n\n## Step 3：收取邮件\n\n### 3.1 查看最近邮件\n\n```bash\n# 查看最近 10 封邮件（默认）\npython3 scripts/receive_mail.py --list\n\n# 查看最近 20 封\npython3 scripts/receive_mail.py --list --count 20\n\n# 指定邮箱\npython3 scripts/receive_mail.py --list --from-addr \"me@163.com\"\n```\n\n### 3.2 读取邮件内容\n\n```bash\n# 读取指定邮件（UID 从 --list 获取）\npython3 scripts/receive_mail.py --read 123 --provider qq\n```\n\n### 3.3 下载附件\n\n```bash\n# 读取邮件并下载附件\npython3 scripts/receive_mail.py --read 123 --download-attachment 123 --save-dir \"${OPENCLAW_WORKSPACE:-$PWD}/downloads\"\n```\n\n### 3.4 搜索邮件\n\n```bash\n# 按关键词搜索\npython3 scripts/receive_mail.py --search \"合同\" --provider qq\n\n# 按发件人搜索\npython3 scripts/receive_mail.py --search \"\" --from-filter \"zhangsan@company.com\" --provider qq\n\n# 按日期范围搜索\npython3 scripts/receive_mail.py --search \"报告\" --since \"2026-04-01\" --provider gmail\n\n# 组合搜索\npython3 scripts/receive_mail.py --search \"发票\" --from-filter \"finance@company.com\" --since \"2026-04-01\" --count 5\n```\n\n---\n\n## Step 4：回复邮件\n\n### 先获取原邮件 Message-ID\n\n```bash\n# 1. 找到要回复的邮件\npython3 scripts/receive_mail.py --list --count 5 --provider qq\n\n# 2. 读取邮件获取 Message-ID\npython3 scripts/receive_mail.py --read 123 --provider qq\n# 输出中包含: 💡 回复此邮件请使用 --reply-to \"<msgid@qq.com>\"\n```\n\n### 回复邮件\n\n```bash\npython3 scripts/send_mail.py \\\n  --to \"sender@example.com\" \\\n  --subject \"Re: 原始邮件主题\" \\\n  --body \"收到，我确认无误。\" \\\n  --reply-to \"<msgid@qq.com>\" \\\n  --provider qq\n```\n\n---\n\n## Step 5：搜索邮件\n\n```bash\n# 搜索包含\"合同\"的邮件\npython3 scripts/receive_mail.py --search \"合同\" --provider qq\n\n# 搜索特定发件人的邮件\npython3 scripts/receive_mail.py --search \"\" --from-filter \"zhangsan@company.com\"\n\n# 搜索特定主题的邮件\npython3 scripts/receive_mail.py --search \"\" --subject-filter \"周报\"\n\n# 按日期搜索\npython3 scripts/receive_mail.py --search \"\" --since \"2026-04-01\" --provider outlook\n```\n\n---\n\n## Step 6：文档数据联动\n\n将文档数据处理与邮件发送结合。\n\n详细工作流和代码示例 → `references/integrations.md`\n\n### 常见联动模式\n\n```\n1. Excel → 邮件：读取 Excel 数据 → 生成 HTML 表格 → 发送\n2. OCR → 邮件：识别发票/合同 → 提取关键信息 → 格式化 → 发送\n3. PDF → 邮件：处理 PDF → 摘要 + 附件 → 发送\n4. 数据分析 → 邮件：分析数据 → 生成结论 → 发送\n5. 定时日报：生成日报 → 定时发送\n```\n\n### Excel 数据发送示例\n\n```bash\n# Step 1: 使用 excel-studio 或 python3 读取 Excel 数据\n# Step 2: 将数据格式化为 HTML 表格（使用 templates.md 中的商务报告模板）\n# Step 3: 保存 HTML 内容\ncat > \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" << 'EOF'\n{使用模板生成的HTML}\nEOF\n\n# Step 4: 发送\npython3 scripts/send_mail.py \\\n  --to \"boss@company.com\" \\\n  --subject \"销售周报 $(date +%Y%m%d)\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --attach \"/path/to/report.xlsx\"\n```\n\n完整联动流程 → `references/integrations.md`\n\n---\n\n## Step 7：定时发送\n\n### 在指定时间发送\n\n```bash\n# 指定具体时间\npython3 scripts/schedule_mail.py \\\n  --schedule --at \"2026-04-19 09:00\" \\\n  --to \"boss@company.com\" \\\n  --subject \"工作日报 - 2026-04-19\" \\\n  --body \"今日工作内容...\" \\\n  --provider qq\n```\n\n### 在 N 分钟后发送\n\n```bash\n# 30 分钟后发送\npython3 scripts/schedule_mail.py \\\n  --schedule --in 30 \\\n  --to \"client@example.com\" \\\n  --subject \"跟进\" \\\n  --body \"关于上次会议讨论的事项...\" \\\n  --provider qq\n```\n\n### 管理定时任务\n\n```bash\n# 查看已安排的定时邮件\npython3 scripts/schedule_mail.py --list-scheduled\n\n# 取消定时邮件\npython3 scripts/schedule_mail.py --cancel SCHEDULE_ID\n\n# 手动处理到期的定时邮件\npython3 scripts/schedule_mail.py --process-queue\n```\n\n### 推荐设置定时处理\n\n```bash\n# 添加 1 分钟间隔的定时处理\n(crontab -l 2>/dev/null; echo \"* * * * * python3 $(pwd)/scripts/schedule_mail.py --process-queue\") | crontab -\n```\n\n---\n\n## Step 8：HTML 邮件模板\n\n7 种专业模板 → `references/templates.md`\n\n| 模板 | 用途 | 场景 |\n|------|------|------|\n| 商务报告 | 数据报表 | 周报、月报、数据分析 |\n| 会议邀请 | 邀请参会 | 会议、活动、面试 |\n| 通知公告 | 重要通知 | 公司公告、系统通知 |\n| 感谢信 | 表达感谢 | 合作感谢、面试感谢 |\n| 周报/日报 | 工作汇报 | 每日/每周工作报告 |\n| 发票通知 | 单据发送 | 发票、合同、收据 |\n| 正式信函 | 正式通信 | 商务函件、公函 |\n\n---\n\n## 错误处理\n\n```\n错误类型                      → 处理方式\n──────────────────────────────────────────────────────\nSMTP 认证失败                 → 检查授权码，参考 providers.md\nIMAP 连接失败                 → 检查 IMAP 服务是否开启，检查网络\n连接超时                      → Gmail/Yahoo/iCloud 需要 VPN\n发送频率限制                   → 等待后重试（QQ 1封/分钟）\n附件过大                      → 超过 25MB 建议用网盘链接\n收件人不存在                   → 检查邮箱地址是否正确\nIMAP 服务未开启               → 参考 providers.md 开启 IMAP\n163 密码错误                   → 163 需使用客户端授权密码\n```\n\n---\n\n## 服务商配置详情\n\n12+ 服务商的 IMAP/SMTP 配置、授权码获取教程 → `references/providers.md`\n\n## 隐私与安全\n\n- 使用 IMAP/SMTP 协议直连邮箱服务器，数据不经第三方\n- 授权码存储在环境变量中，不写入文件\n- 授权码仅用于邮件收发，不可登录邮箱网页版\n- 建议使用专用授权码而非主密码\n- 定时邮件队列存储在 `~/.emailbox/queue/`，敏感信息请及时清理\n\n## 注意事项\n\n- 需要预先开启邮箱的 IMAP/SMTP 服务并获取授权码\n- Gmail/Yahoo/iCloud 国内需翻墙\n- QQ 邮箱发送限制：每天 500 封，每分钟 1 封\n- 163 邮箱发送限制：每天 200 封\n- 附件大小限制：QQ 50MB / Gmail 25MB / Outlook 20MB\n- 定时发送依赖系统调度器（at/crontab），如不可用需手动处理队列\n\nFile v1.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn75z6gevjsyrznm7dg2ez6sen82h8sz\",\n  \"slug\": \"emailbox\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1776527396384\n}\n\nFile v1.0.0:references/integrations.md\n\n# 文档数据联动 Document Integration\n\n邮件与文档数据处理的一体化工作流。结合其他 Skills 的能力，实现\"数据处理 → 格式化 → 邮件发送\"的自动化。\n\n---\n\n## 场景总览\n\n| 场景 | 数据来源 | 邮件输出 | 关联 Skill |\n|------|----------|----------|-----------|\n| Excel 报表发送 | .xlsx/.csv 数据 | HTML 表格 + 附件 | excel-studio |\n| 发票识别+邮件 | 图片/PDF 发票 | 结构化摘要 + 附件 | china-doc-ocr |\n| 合同审核+邮件 | 合同 PDF | 审核要点 + 附件 | china-doc-ocr, china-legal-analysis |\n| PDF 报告发送 | PDF 文件 | 摘要 + 附件 | pdf-studio |\n| 简历解析+邮件 | 简历 PDF/Word | 候选人摘要 + 附件 | china-doc-ocr |\n| 数据分析+邮件 | 原始数据 | 分析结论 + 图表 | data-analyzer |\n\n---\n\n## 工作流模板\n\n### 流程 1：Excel 数据 → 格式化邮件\n\n```\n用户请求：\"把这个 Excel 的销售数据做成表格发邮件给老板\"\n↓\nStep 1: 读取 Excel 文件\n  → 使用 excel-studio 读取数据\n  → 或使用 python3 + openpyxl 直接读取\n↓\nStep 2: 数据处理与格式化\n  → 提取关键指标（总计、变化、排名等）\n  → 生成 HTML 表格（使用 templates.md 中商务报告模板）\n  → 生成纯文本摘要（作为 fallback）\n↓\nStep 3: 生成邮件内容并保存\n  → 将 HTML 保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.html\n  → 将纯文本保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.txt\n↓\nStep 4: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to boss@company.com \\\n    --subject \"销售数据周报 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/sales_data.xlsx \\\n    --provider qq\n```\n\n### 流程 2：OCR 识别 → 邮件通知\n\n```\n用户请求：\"识别这张发票，把结果发邮件给财务\"\n↓\nStep 1: OCR 识别\n  → 使用 china-doc-ocr 识别发票图片/PDF\n  → 提取关键字段：发票号码、金额、日期、购方/销方信息\n↓\nStep 2: 格式化邮件内容\n  → 使用 templates.md 中的发票通知模板\n  → 填入识别出的字段数据\n  → 生成纯文本摘要\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to finance@company.com \\\n    --subject \"发票处理 - ${invoice_number}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/invoice.jpg \\\n    --provider 163\n```\n\n### 流程 3：合同审核 → 邮件汇报\n\n```\n用户请求：\"审核这份合同后把要点发邮件给法务\"\n↓\nStep 1: 识别合同\n  → 使用 china-doc-ocr 识别合同文本\n↓\nStep 2: 法律分析\n  → 使用 china-legal-analysis 分析合同条款\n  → 提取风险点和审核意见\n↓\nStep 3: 格式化并发送\n  python3 scripts/send_mail.py \\\n    --to legal@company.com \\\n    --subject \"合同审核报告 - ${contract_name}\" \\\n    --body-","readmeExcerpt":"Skill: Emailbox Owner: tobewin Summary: 职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachmen... Tags: 163:1.2.0, attachment:1.2.0, china:1.2.0, email:1.2.0, emailbox:1.0.0, forward:1.2.0, gmail:1.2.0, html-template:1.2.0, imap:1.2.0, international:1.2.0, latest:1.2.1, outlook:1.2.0, qq:1.2.0, schedule:1.2.0, smtp:","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"# Set 2 environment variables and you're ready\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_authorization_code\""},{"language":"bash","snippet":"# QQ Mail\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_auth_code\"\n\n# 163 Mail\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\""},{"language":"bash","snippet":"# Option A: Session-only (recommended for security)\n# Set environment variables in your current shell session only.\n# Credentials will NOT persist after the session ends.\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_auth_code\"\n\n# Option B: Keychain / secret manager\n# macOS: Use `security add-internet-password`\n# Linux: Use `secret-tool store` (libsecret)\n# Windows: Use Windows Credential Manager\n\n# Option C: Restricted file (if persistent config is required)\n# Create a file with restricted permissions that only you can read:\nmkdir -p ~/.emailbox && touch ~/.emailbox/credentials\nchmod 600 ~/.emailbox/credentials\n# Then add your credentials:\n# EMAIL_ADDRESS=your@qq.com\n# EMAIL_AUTH=your_auth_code\n# \n# Before running emailbox commands:\n# source ~/.emailbox/credentials"},{"language":"bash","snippet":"python3 scripts/send_mail.py \\\n  --to \"recipient@example.com\" \\\n  --subject \"Project Update\" \\\n  --body \"Hi, here is the project update...\" \\\n  --provider qq"},{"language":"bash","snippet":"python3 scripts/send_mail.py \\\n  --to \"boss@company.com,team@company.com\" \\\n  --cc \"hr@company.com\" \\\n  --bcc \"archive@company.com\" \\\n  --subject \"Weekly Report\" \\\n  --body \"Please find the weekly report attached.\" \\\n  --provider 163"},{"language":"bash","snippet":"python3 scripts/send_mail.py \\\n  --to \"client@company.com\" \\\n  --subject \"Sales Report - 2026W16\" \\\n  --body-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.txt\" \\\n  --html-file \"${OPENCLAW_WORKSPACE:-$PWD}/.emailbox_body.html\" \\\n  --provider outlook"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: emailbox\ndescription: 职业邮箱收发与数据处理一体化工具。IMAP/SMTP protocol for 12+ providers (Gmail/Outlook/QQ/163/Yahoo/iCloud etc). Send/receive/search/schedule emails, HTML templates, attachments, forwarding, data integration. 邮件收发、搜索、定时发送、附件、HTML模板、转发、文档数据联动。\nversion: 1.2.0\nlicense: MIT-0\nmetadata: {\"openclaw\": {\"emoji\": \"📬\", \"requires\": {\"bins\": [\"python3\"], \"env\": [\"EMAIL_ADDRESS\", \"EMAIL_AUTH\"]}, \"primaryEnv\": \"EMAIL_AUTH\"}}\n---\n\n# Emailbox - Professional Email Client & Data Integration\n\nIMAP/SMTP-based email toolkit supporting 12+ providers. Send, receive, search, forward, schedule emails with HTML templates, attachments, and document data integration.\n\n> ⚠️ **数据外发提醒**：邮件内容（收件人、主题、正文、附件）通过 IMAP/SMTP 协议直接发送至邮件服务商服务器。涉及发票、合同、简历等敏感数据时，请在发送前确认收件人正确。\n>\n> ⚠️ **凭据安全**：邮箱授权码等同于密码。环境变量可能通过 shell history、进程列表、CI 日志泄露。每次使用完后建议 `unset EMAIL_AUTH`。\n\n## Features\n\n- **Send**: Plain text, HTML, attachments, CC/BCC, reply, forward\n- **Receive**: List inbox, read emails, download attachments\n- **Search**: By keyword (subject/from/body), date range, sender\n- **Forward**: Fetch original email, forward to new recipients\n- **Schedule**: Send emails at a future time\n- **Templates**: 7 professional HTML email templates\n- **Integration**: Excel/OCR/PDF data → format → email\n- **Providers**: QQ, 163, 126, Sina, Outlook, Gmail, Yahoo, iCloud, Tencent Exmail, Ali Mail, Huawei, 139\n\n## Trigger\n\n- \"Send email to...\" / \"发邮件给...\"\n- \"Check inbox\" / \"查看收件箱\"\n- \"Reply to this email\" / \"回复这封邮件\"\n- \"Forward this email\" / \"转发这封邮件\"\n- \"Search emails from...\" / \"搜索...的邮件\"\n- \"Schedule email for...\" / \"定时发送...\"\n- \"Process data and email...\" / \"整理数据后发邮件\"\n- \"Attach this file...\" / \"添加附件...\"\n\n---\n\n## Step 0: Setup\n\n### Quick Start (Single Account)\n\n```bash\n# Set 2 environment variables and you're ready\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n> ⚠️ `export` 设置的变量在当前 shell 及所有子进程可见（包括 ps 命令、CI 日志、崩溃报告）。\n> 用完建议 `unset EMAIL_AUTH`，或使用 `.env` 文件 + `source` 替代一次性 export。\n\n### Multi-Account Setup\n\n```bash\n# QQ Mail\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_auth_code\"\n\n# 163 Mail\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### Provider Auth Guide\n\nHow to get authorization codes for each provider → `references/providers.md`\n\n> ⚠️ 授权码等同于邮箱密码，拥有它可以收发你的所有邮件。不要分享给他人，不要在公共终端设置。\n\n### Persistent Config\n\n**IMPORTANT: Never store email credentials in plaintext files.** Use your system's secure credential manager or session-only environment variables.\n\n```bash\n# Option A: Session-only (recommended for security)\n# Set environment variables in your current shell session only.\n# Credentials will NOT persist after the session ends.\nexport EMAIL_ADDRESS=\"your@qq.com\"\nexport EMAIL_AUTH=\"your_auth_code\"\n\n# Option B: Keychain / secret manager\n# macOS: Use `security add-internet-password`\n# Linux: Use `secret-tool store` (libsecret)\n# Wind"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn75z6gevjsyrznm7dg2ez6sen82h8sz\",\n  \"slug\": \"emailbox\",\n  \"version\": \"1.2.1\",\n  \"publishedAt\": 1783070522027\n}"},{"path":"references/integrations.md","content":"# 文档数据联动 Document Integration\n\n邮件与文档数据处理的一体化工作流。结合其他 Skills 的能力，实现\"数据处理 → 格式化 → 邮件发送\"的自动化。\n\n> ⚠️ 以下工作流涉及发票、合同、简历等敏感数据的邮件发送。\n> 执行前务必确认收件人地址正确，且用户确实授权发送这些数据。\n\n---\n\n## 场景总览\n\n| 场景 | 数据来源 | 邮件输出 | 关联 Skill |\n|------|----------|----------|-----------|\n| Excel 报表发送 | .xlsx/.csv 数据 | HTML 表格 + 附件 | excel-studio |\n| 发票识别+邮件 | 图片/PDF 发票 | 结构化摘要 + 附件 | china-doc-ocr |\n| 合同审核+邮件 | 合同 PDF | 审核要点 + 附件 | china-doc-ocr, china-legal-analysis |\n| PDF 报告发送 | PDF 文件 | 摘要 + 附件 | pdf-studio |\n| 简历解析+邮件 | 简历 PDF/Word | 候选人摘要 + 附件 | china-doc-ocr |\n| 数据分析+邮件 | 原始数据 | 分析结论 + 图表 | data-analyzer |\n\n---\n\n## 工作流模板\n\n### 流程 1：Excel 数据 → 格式化邮件\n\n```\n用户请求：\"把这个 Excel 的销售数据做成表格发邮件给老板\"\n↓\nStep 1: 读取 Excel 文件\n  → 使用 excel-studio 读取数据\n  → 或使用 python3 + openpyxl 直接读取\n↓\nStep 2: 数据处理与格式化\n  → 提取关键指标（总计、变化、排名等）\n  → 生成 HTML 表格（使用 templates.md 中商务报告模板）\n  → 生成纯文本摘要（作为 fallback）\n↓\nStep 3: 生成邮件内容并保存\n  → 将 HTML 保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.html\n  → 将纯文本保存为 ${OPENCLAW_WORKSPACE}/.emailbox_body.txt\n↓\nStep 4: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to boss@company.com \\\n    --subject \"销售数据周报 - $(date +%Y%m%d)\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/sales_data.xlsx \\\n    --provider qq\n```\n\n### 流程 2：OCR 识别 → 邮件通知\n\n> ⚠️ 本流程将发送发票金额、号码、购方/销方信息等财务数据。发送前确认收件人是正确的财务负责人邮箱。\n\n```\n用户请求：\"识别这张发票，把结果发邮件给财务\"\n↓\nStep 1: OCR 识别\n  → 使用 china-doc-ocr 识别发票图片/PDF\n  → 提取关键字段：发票号码、金额、日期、购方/销方信息\n↓\nStep 2: 格式化邮件内容\n  → 使用 templates.md 中的发票通知模板\n  → 填入识别出的字段数据\n  → 生成纯文本摘要\n↓\nStep 3: 发送邮件\n  python3 scripts/send_mail.py \\\n    --to finance@company.com \\\n    --subject \"发票处理 - ${invoice_number}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/invoice.jpg \\\n    --provider 163\n```\n\n### 流程 3：合同审核 → 邮件汇报\n\n> ⚠️ 合同内容、法务分析、风险点属于高度敏感信息。发送前向用户确认收件人（法务邮箱）无误，且用户清楚邮件包含合同原文及审核意见。\n\n```\n用户请求：\"审核这份合同后把要点发邮件给法务\"\n↓\nStep 1: 识别合同\n  → 使用 china-doc-ocr 识别合同文本\n↓\nStep 2: 法律分析\n  → 使用 china-legal-analysis 分析合同条款\n  → 提取风险点和审核意见\n↓\nStep 3: 格式化并发送\n  python3 scripts/send_mail.py \\\n    --to legal@company.com \\\n    --subject \"合同审核报告 - ${contract_name}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/contract.pdf \\\n    --importance high \\\n    --provider qq\n```\n\n### 流程 4：简历解析 → 转发 HR\n\n> ⚠️ 简历包含姓名、学历、工作经历等个人敏感信息（PII）。发送前确认用户有权转发该简历，且收件人（HR 邮箱）正确。\n\n```\n用户请求：\"解析这份简历然后转发给HR\"\n↓\nStep 1: 识别简历\n  → 使用 china-doc-ocr 识别简历 PDF/图片\n↓\nStep 2: 结构化提取\n  → 提取姓名、学历、工作经验、技能等\n  → 生成候选人摘要卡片\n↓\nStep 3: 转发邮件\n  python3 scripts/send_mail.py \\\n    --to hr@company.com \\\n    --subject \"候选人推荐 - ${candidate_name} - ${position}\" \\\n    --body-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.txt\" \\\n    --html-file \"${OPENCLAW_WORKSPACE}/.emailbox_body.html\" \\\n    --attach /path/to/resume.pdf\n```\n\n### 流程 5：数据分析 → 邮件报告\n\n```\n用户请求：\"分析这份数据后发邮件给团队\"\n↓\nStep 1: 读取和数据\n  → 使用 data-analyzer 或 python3 分析 CS"},{"path":"references/providers.md","content":"# 邮箱服务商配置 Email Provider Configuration\n\n## 12+ 服务商 IMAP/SMTP 配置\n\n| 服务商 | IMAP 服务器 | SMTP 服务器 | SMTP 端口 | SSL | 环境变量 |\n|--------|-------------|-------------|----------|-----|----------|\n| QQ 邮箱 | imap.qq.com | smtp.qq.com | 465 | SSL | EMAIL_QQ / EMAIL_QQ_AUTH |\n| 163 邮箱 | imap.163.com | smtp.163.com | 465 | SSL | EMAIL_163 / EMAIL_163_AUTH |\n| 126 邮箱 | imap.126.com | smtp.126.com | 465 | SSL | EMAIL_126 / EMAIL_126_AUTH |\n| 新浪邮箱 | imap.sina.com | smtp.sina.com | 465 | SSL | EMAIL_SINA / EMAIL_SINA_AUTH |\n| Outlook | outlook.office365.com | smtp.office365.com | 587 | STARTTLS | EMAIL_OUTLOOK / EMAIL_OUTLOOK_AUTH |\n| Gmail | imap.gmail.com | smtp.gmail.com | 587 | STARTTLS | EMAIL_GMAIL / EMAIL_GMAIL_AUTH |\n| Yahoo | imap.mail.yahoo.com | smtp.mail.yahoo.com | 587 | STARTTLS | EMAIL_YAHOO / EMAIL_YAHOO_AUTH |\n| iCloud | imap.mail.me.com | smtp.mail.me.com | 587 | STARTTLS | EMAIL_ICLOUD / EMAIL_ICLOUD_AUTH |\n| 腾讯企业邮箱 | imap.exmail.qq.com | smtp.exmail.qq.com | 465 | SSL | EMAIL_EXMAIL / EMAIL_EXMAIL_AUTH |\n| 阿里企业邮箱 | imap.mxhichina.com | smtp.mxhichina.com | 465 | SSL | EMAIL_ALIMAIL / EMAIL_ALIMAIL_AUTH |\n| 华为邮箱 | imap.mail.hicloud.com | smtp.mail.hicloud.com | 465 | SSL | EMAIL_HUAWEI / EMAIL_HUAWEI_AUTH |\n| 139 邮箱 | imap.mail.139.com | smtp.mail.139.com | 465 | SSL | EMAIL_139 / EMAIL_139_AUTH |\n\n---\n\n## 环境变量配置\n\n### 单账号模式（推荐新手）\n\n最简配置，只需 2 个环境变量：\n\n```bash\nexport EMAIL_ADDRESS=\"your@email.com\"\nexport EMAIL_AUTH=\"your_authorization_code\"\n```\n\n### 多账号模式（支持多个邮箱）\n\n每个邮箱单独配置：\n\n```bash\n# QQ 邮箱\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"qq_authorization_code\"\n\n# 163 邮箱\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"163_client_password\"\n\n# Outlook\nexport EMAIL_OUTLOOK=\"your@outlook.com\"\nexport EMAIL_OUTLOOK_AUTH=\"outlook_app_password\"\n\n# Gmail\nexport EMAIL_GMAIL=\"your@gmail.com\"\nexport EMAIL_GMAIL_AUTH=\"gmail_app_password\"\n```\n\n### 优先级规则\n\n1. 命令行指定 `--from-addr` 和 `--provider` 最高优先\n2. 对应服务商的环境变量（如 `EMAIL_QQ` / `EMAIL_QQ_AUTH`）\n3. 通用环境变量 `EMAIL_ADDRESS` / `EMAIL_AUTH`\n\n---\n\n## Authorization Code Setup / 授权码获取教程\n\n### QQ Mail / QQ 邮箱\n\n1. Log in to QQ Mail (mail.qq.com) → Settings (设置) → Account (账号)\n2. Find \"POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV Service\"\n3. Enable IMAP/SMTP service\n4. Click \"Generate Authorization Code\" (生成授权码)\n5. Follow prompts to send SMS verification from your phone\n6. Receive 16-character authorization code (no spaces)\n\n```bash\nexport EMAIL_QQ=\"your@qq.com\"\nexport EMAIL_QQ_AUTH=\"abcdefghijklmnop\"\n```\n\n**Note:** QQ Mail authorization code is 16 letters, NOT your QQ password.\n\n### 163 Mail / 163 邮箱\n\n1. Log in to 163 Mail (mail.163.com) → Settings (设置) → POP3/SMTP/IMAP\n2. Enable \"IMAP/SMTP Service\"\n3. Click \"Client Authorization Password\" (客户端授权密码)\n4. Verify via SMS, then set the authorization password\n\n```bash\nexport EMAIL_163=\"your@163.com\"\nexport EMAIL_163_AUTH=\"your_client_password\"\n```\n\n**Note:** 163 Mail requires authorization password, NOT your login password.\n\n### 126 Mail / 126 邮箱\n\n1. Log in to 126 Mail (mail.126.co"},{"path":"references/templates.md","content":"# HTML 邮件模板 HTML Email Templates\n\n专业邮件 HTML 模板，支持中英文场景。使用时将占位符 `{变量名}` 替换为实际内容。\n\n---\n\n## 1. 商务报告模板 Business Report\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px 0;\">\n<tr><td align=\"center\">\n<table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#ffffff;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,0.08);\">\n<tr><td style=\"background:linear-gradient(135deg,#1a5276,#2e86c1);padding:30px 40px;color:#ffffff;\">\n<h1 style=\"margin:0;font-size:22px;\">{report_title}</h1>\n<p style=\"margin:8px 0 0;font-size:14px;opacity:0.9;\">{report_period} | {report_date}</p>\n</td></tr>\n<tr><td style=\"padding:30px 40px;\">\n<p style=\"margin:0 0 20px;font-size:15px;color:#333;\">{greeting}，</p>\n<p style=\"margin:0 0 20px;font-size:14px;color:#555;line-height:1.8;\">{summary}</p>\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;margin:20px 0;\">\n<thead><tr style=\"background:#eaf2f8;\">\n<th style=\"padding:12px 16px;text-align:left;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col1_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col2_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col3_header}</th>\n<th style=\"padding:12px 16px;text-align:right;font-size:13px;color:#1a5276;border-bottom:2px solid #2e86c1;\">{col4_header}</th>\n</tr></thead>\n<tbody>\n{table_rows}\n</tbody>\n</table>\n<p style=\"margin:20px 0 0;font-size:14px;color:#555;line-height:1.8;\">{detail_text}</p>\n</td></tr>\n<tr><td style=\"background:#f9f9f9;padding:20px 40px;border-top:1px solid #eee;font-size:12px;color:#999;text-align:center;\">\n{sender_name} | {sender_department}<br>\n此邮件由 emailbox 自动发送\n</td></tr>\n</table>\n</td></tr>\n</table>\n</body>\n</html>\n```\n\n**表格行模板：**\n```html\n<tr style=\"border-bottom:1px solid #eee;\">\n<td style=\"padding:10px 16px;font-size:14px;color:#333;\">{col1_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col2_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;color:#555;\">{col3_value}</td>\n<td style=\"padding:10px 16px;text-align:right;font-size:14px;font-weight:bold;color:{positive_color};\">{col4_value}</td>\n</tr>\n```\n\n---\n\n## 2. 会议邀请模板 Meeting Invitation\n\n```html\n<!DOCTYPE html>\n<html>\n<head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"></head>\n<body style=\"margin:0;padding:0;background:#f5f5f5;font-family:'Helvetica Neue',Arial,'PingFang SC','Microsoft YaHei',sans-serif;\">\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#f5f5f5;padding:20px "}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1238,"uniquenessScore":43,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T11:20:47.473Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T11:20:47.473Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T14:14:51.692Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}