Email Skill — Agent Auth-Completion
You have the email address $MAILS_MAILBOX. Your primary superpower: complete service registrations autonomously by receiving verification codes via GET /api/code?timeout=60.
Make HTTP requests to $MAILS_API_URL with header Authorization: Bearer $MAILS_AUTH_TOKEN.
Sign up for a service: Fill form with $MAILS_MAILBOX → GET /api/code?timeout=60 → enter the code. Done.
API Endpoints
| Method | Endpoint | Description |
|---|
| GET | /api/inbox | List emails. Params: query, limit, offset, direction, label, INLINECODE10 |
| GET |
/api/email?id=ID | Full email with body, attachments, labels |
| GET | /api/code?timeout=60 | Wait for verification code (long-poll). Params:
timeout,
since |
| POST | /api/send | Send email. Body:
{ from, to[], subject, text, html, reply_to, headers, attachments } |
| DELETE | /api/email?id=ID | Delete email and attachments |
| GET | /api/attachment?id=ID | Download attachment |
| GET | /api/threads | List conversation threads. Params:
to,
limit,
offset |
| GET | /api/thread?id=ID | Get all emails in a thread. Params:
to |
| POST | /api/extract | Extract structured data. Body:
{ email_id, type } type: order/shipping/calendar/receipt/code |
| GET | /api/search?q=TEXT | Semantic/hybrid search. Params:
mode (keyword/semantic/hybrid) |
| GET | /api/me | Worker info and capabilities |
| GET | /health | Health check (no auth) |
Request Format
All requests (except /health) require Authorization: Bearer $MAILS_AUTH_TOKEN header.
POST requests require Content-Type: application/json header.
Inbox query params: to=$MAILS_MAILBOX is required for mailbox scoping.
Response Shapes
Inbox: INLINECODE23
Email detail: Full email object with body_text, body_html, headers, metadata, labels, thread_id, INLINECODE30
Code: { "code": "483920", "from": "...", "subject": "..." } or INLINECODE32
Threads: INLINECODE33
Extract: INLINECODE34
Send Fields
| Field | Required | Description |
|---|
| from | Yes | Must be $MAILS_MAILBOX (enforced server-side) |
| to |
Yes | Array of recipients (max 50) |
| subject | Yes | Max 998 characters |
| text | text or html | Plain text body |
| html | text or html | HTML body |
| reply_to | No | Reply-to address |
| headers | No | Custom headers object |
| attachments | No |
[{ filename, content (base64), content_type?, content_id? }] |
Labels
Emails are auto-labeled on receive: newsletter, notification, code, personal. Filter with ?label=notification.
Common Flows
Sign up for a service: Fill form with $MAILS_MAILBOX → GET /api/code?timeout=60 → enter the code
Process inbox: GET /api/inbox → GET /api/email?id=ID → DELETE /api/email?id=ID
View threads: GET /api/threads?to=$MAILSMAILBOX → GET /api/thread?id=THREADID
Extract data: POST /api/extract with INLINECODE43
Constraints
- -
from must match INLINECODE45 - Verification codes: 4-12 alphanumeric (EN/ZH/JA/KO)
- Code wait timeout max 55 seconds
- Search uses FTS5 full-text search (keyword mode) or Vectorize (semantic mode)
邮件技能 — 代理认证完成
你拥有邮箱地址 $MAILS_MAILBOX。你的核心超能力:通过 GET /api/code?timeout=60 接收验证码,自主完成服务注册。
向 $MAILSAPIURL 发起 HTTP 请求,需携带请求头 Authorization: Bearer $MAILSAUTHTOKEN。
注册服务: 使用 $MAILS_MAILBOX 填写表单 → GET /api/code?timeout=60 → 输入验证码。完成。
API 端点
| 方法 | 端点 | 描述 |
|---|
| GET | /api/inbox | 列出邮件。参数:query、limit、offset、direction、label、mode |
| GET |
/api/email?id=ID | 完整邮件,包含正文、附件、标签 |
| GET | /api/code?timeout=60 | 等待验证码(长轮询)。参数:timeout、since |
| POST | /api/send | 发送邮件。请求体:{ from, to[], subject, text, html, reply_to, headers, attachments } |
| DELETE | /api/email?id=ID | 删除邮件及附件 |
| GET | /api/attachment?id=ID | 下载附件 |
| GET | /api/threads | 列出会话线程。参数:to、limit、offset |
| GET | /api/thread?id=ID | 获取线程中所有邮件。参数:to |
| POST | /api/extract | 提取结构化数据。请求体:{ email_id, type } type: order/shipping/calendar/receipt/code |
| GET | /api/search?q=TEXT | 语义/混合搜索。参数:mode(keyword/semantic/hybrid) |
| GET | /api/me | 工作器信息及能力 |
| GET | /health | 健康检查(无需认证) |
请求格式
所有请求(/health 除外)均需携带 Authorization: Bearer $MAILSAUTHTOKEN 请求头。
POST 请求需携带 Content-Type: application/json 请求头。
收件箱查询参数:邮箱范围限定需使用 to=$MAILS_MAILBOX。
响应格式
收件箱:{ emails: [{ id, fromaddress, fromname, subject, code, direction, status, receivedat, hasattachments, attachment_count }] }
邮件详情:完整邮件对象,包含 bodytext、bodyhtml、headers、metadata、labels、thread_id、attachments[]
验证码:{ code: 483920, from: ..., subject: ... } 或 { code: null }
线程:{ threads: [{ threadid, latestemailid, subject, fromaddress, fromname, receivedat, messagecount, hasattachments }] }
提取:{ emailid: ..., extraction: { type: order, orderid: ..., ... } }
发送字段
| 字段 | 必填 | 描述 |
|---|
| from | 是 | 必须为 $MAILS_MAILBOX(服务端强制校验) |
| to |
是 | 收件人数组(最多50个) |
| subject | 是 | 最多998个字符 |
| text | text 或 html | 纯文本正文 |
| html | text 或 html | HTML 正文 |
| reply_to | 否 | 回复地址 |
| headers | 否 | 自定义请求头对象 |
| attachments | 否 | [{ filename, content (base64), content
type?, contentid? }] |
标签
邮件接收时自动打标签:newsletter、notification、code、personal。使用 ?label=notification 进行过滤。
常见流程
注册服务: 使用 $MAILS_MAILBOX 填写表单 → GET /api/code?timeout=60 → 输入验证码
处理收件箱: GET /api/inbox → GET /api/email?id=ID → DELETE /api/email?id=ID
查看线程: GET /api/threads?to=$MAILSMAILBOX → GET /api/thread?id=THREADID
提取数据: POST /api/extract 使用 {email_id:ID,type:order}
约束条件
- - from 必须与 $MAILS_MAILBOX 匹配
- 验证码:4-12位字母数字(中/英/日/韩)
- 验证码等待超时最长55秒
- 搜索使用 FTS5 全文搜索(关键词模式)或 Vectorize(语义模式)