Email Auto Reply (Streamax)
Operate on Streamax Coremail at mail.streamax.com.
Default transport: Web JSON API (same path as the browser — works without VPN).
IMAP/SMTP remain available when the company network resolves imap/smtp.streamax.com.
Hard rules
- Never send until the user explicitly confirms the draft (e.g.「确认发送」or "send it").
- Show the full draft (To / Subject / Body) before asking for confirmation.
- Do not store passwords in chat or commit
.env. Use env vars / local.env. - Prefer reply (In-Reply-To / References) over a new thread unless asked otherwise.
Prerequisites
- Copy
.env.exampleto.envin this skill directory and fill values. MAIL_PASSWORDmust be the 客户端专用密码 from webmail settings.- Python 3.10+; optional:
pip install -r scripts/requirements.txt.
| Role | Host / URL | Notes |
|------|------------|-------|
| Web API (default) | https://mail.test.com/coremail | No VPN needed |
| IMAP | imap.test.com:993 | Often needs company network |
| SMTP | smtp.test.com:465 | Often needs company network |
See reference.md for env vars and troubleshooting.
Workflow
Email task:
- [ ] 1. Load config / verify credentials present
- [ ] 2. Fetch matching messages
- [ ] 3. Summarize for user (do not dump huge bodies unless asked)
- [ ] 4. Draft reply (AI)
- [ ] 5. Present draft → wait for explicit confirm
- [ ] 6. Send via script
- [ ] 7. Optionally mark original as read
1. Fetch mail
python scripts/fetch_mail.py --unread
python scripts/fetch_mail.py --unread --from "alice@example.com"
python scripts/fetch_mail.py --uid "1:xxxx" --full
python scripts/fetch_mail.py --unread --via imap
| Flag | Meaning |
|------|---------|
| --unread | Unread only |
| --since YYYY-MM-DD | Since date (IMAP only) |
| --from TEXT | FROM contains TEXT |
| --subject TEXT | SUBJECT contains TEXT |
| --limit N | Max messages (default 20) |
| --uid ID | Single message id (web) / IMAP UID |
| --full | Download bodies (web list is headers-only by default) |
| --via web\|imap\|auto | Default web |
| --json | Machine-readable output |
Present a short list: From, Date, Subject, ID. Expand full body with --full or --uid when replying.
2. Draft reply (AI)
- Match the user's language (中文/English) to the original unless told otherwise.
- Be concise, professional, and address the sender's asks.
- Subject: if original has no
Re:, useRe: {original subject}; keep existingRe:/回复:as-is. - Quote lightly only when needed; default to a clean reply body.
- If intent is unclear, ask the user before drafting.
Output format:
## Draft reply
- **To:** ...
- **Subject:** Re: ...
- **In-Reply-To:** <message-id>
- **Body:**
...
Reply「确认发送」to send, or say what to change.
3. Send (only after confirm)
python scripts/send_reply.py \
--to "sender@example.com" \
--subject "Re: original subject" \
--body-file reply.txt \
--in-reply-to "<message-id@mail.streamax.com>" \
--references "<message-id@mail.streamax.com>" \
--mark-read-uid "1:xxxx"
Or:
python scripts/send_reply.py --to "..." --subject "Re: ..." --body "谢谢,已收到。" --mark-read-uid "1:xxxx"
4. Supported filters
- Unread only
- Date range / since date (IMAP)
- Sender and subject keywords
- After reply: mark read +
Re:subject + threading headers
Safety checklist before send
- [ ] User confirmed this exact draft
- [ ] To / Cc match the intended recipients
- [ ] No secrets accidentally included
- [ ] Correct thread headers if this is a reply
Additional resources
- Server details, env vars, edge cases: reference.md
Scan to join WeChat group