本文档供程序 / AI 对接使用。请严格按下方 硬性规则 实现,不要猜测其它邮件服务商的接口格式。
https://weiruan.zmdsbk.com 。不要调用 emailmux 或其它第三方邮箱 API。/api/v1/mail/...。不要混用未带 Key 的旧示例。X-API-Key: <key>(或 Authorization: Bearer <key>)。密钥在管理后台「API 对接」查看,不是文档里的占位符。+ 必须写成 %2B。例:user+tag@outlook.com → user%2Btag@outlook.com。GET /api/v1/mail/{email} 只返回 subject/sender/date/id。要验证码正文请再调 detail,或直接从 subject 解析(如 confirmation code: XXX-XXX)。alias,只能查带 + 的别名,查根邮箱会 403;设为 root 则相反。user@outlook.com;查询可用 user+tag@outlook.com,系统会映射并按收件人过滤。+ 别名。X-API-Key: <API_KEY> # 等价 Authorization: Bearer <API_KEY>
API_KEY 仅作首次种子;重置后请用新密钥。
GET /api
响应含 version、auth.api_key_required、auth.api_read_scope。
GET /api/v1/mail/{email}?limit=20&folder=all&refresh=true
| 参数 | 位置 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
| path | string | — | 根邮箱或 + 别名;+→%2B,@ 一般可保留 | |
| limit | query | int | 20 | 1–100 |
| folder | query | string | all | all | inbox | junk |
| refresh | query | bool | false | true 跳过缓存,轮询验证码时建议 true |
{
"email": "user+tag@outlook.com",
"total": 1,
"emails": [
{
"id": "INBOX-AAkALgAAAA...",
"subject": "SpaceXAI confirmation code: 4ML-PWU",
"sender": "SpaceXAI <noreply@x.ai>",
"date": "2026-07-25T02:32:00Z",
"folder": "INBOX"
}
]
}
emails 始终是数组(无邮件时为 [],不会是 null)。
列表不含 content_text / HTML。
curl -sS -H "X-API-Key: YOUR_API_KEY" \ "https://weiruan.zmdsbk.com/api/v1/mail/cielobernhardtpq%2Bdjfmruy@outlook.com?limit=10&refresh=true"
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/v1/mail/{email}/latest/{count} | 最新 N 封(count=1–100),响应同列表 |
| GET | /api/v1/mail/{email}/inbox | 仅收件箱 |
| GET | /api/v1/mail/{email}/junk | 仅垃圾箱 |
| GET | /api/v1/mail/{email}/detail/{message_id} | 详情(含正文);message_id 用列表里的 id,需 URL 编码 |
{
"id": "INBOX-AAkALgAAAA...",
"subject": "SpaceXAI confirmation code: 4ML-PWU",
"sender": "SpaceXAI <noreply@x.ai>",
"recipient": "user+tag@outlook.com",
"date": "2026-07-25T02:32:00Z",
"content_text": ".... 4ML-PWU ....",
"content_html": "<html>...</html>"
}
root+随机标签@outlook.com。refresh=true,limit=10。emails[].subject(及必要时 detail 的 content_text)中用正则提取验证码。# 伪代码 email = "cielobernhardtpq+djfmruy@outlook.com" path = "/api/v1/mail/" + urlencode(email) # 务必把 + 编成 %2B GET base + path + "?limit=10&refresh=true" Header: X-API-Key: <key> 解析 JSON.emails[].subject
在管理后台「API 对接」设置,对所有公开邮件 API 生效。
| 值 | 允许查询 | 禁止 |
|---|---|---|
both | 根邮箱 + 别名 | — |
root | 仅根邮箱 | 带 + 的别名 → 403 |
alias | 仅别名(必须含 + 或点号别名) | 直接查根邮箱 → 403 |
当前运行值见页面顶部徽章,或 GET /api → auth.api_read_scope。
{
"detail": "人类可读说明",
"code": "unauthorized | forbidden | not_found | bad_request | unavailable | error"
}
| HTTP | code | 常见原因 |
|---|---|---|
| 401 | unauthorized | 缺少/错误 API Key |
| 403 | forbidden | 违反全局读邮权限(例如 alias 模式下查了根邮箱) |
| 404 | not_found | 根邮箱未录入系统 |
| 503 | unavailable | OAuth/微软令牌失败 |
+ 原样放进 URL,未编成 %2B → 别名解析失败或查空。alias 时去查根邮箱 → 403,误以为“读不到信”。body/content → 字段不存在,应看 subject 或调 detail。/emails/...(管理端)却只带 API Key → 应用管理员 Bearer 密码,不是对外接口。your-api-key 未替换成真实密钥 → 401。仍可用但请优先 v1:/api/mail/...、/public/emails/{email}/unified。鉴权规则与 v1 相同。
| 范围 | 路径前缀 | 认证 |
|---|---|---|
| 对外读邮 | /api/v1/mail | API Key |
| 管理后台 | /accounts、/emails | Authorization: Bearer <ADMIN_PASSWORD> |