Skip to content

查看邮件列表

http
GET /api/mails?limit=20&toDomain=example.com
X-Admin-Key: your-admin-key

查询参数

参数类型必填说明
limitnumber每页数量,默认 20,范围 1-50
cursorstring下一页游标,使用上次返回的 pagination.nextCursor
fromstring按发件邮箱精确筛选
tostring按收件邮箱精确筛选
toDomainstring按收件域名精确筛选
subjectstring按主题全文检索
contentstring按正文全文检索
hasAttachmentsboolean是否只看带附件邮件,支持 truefalse10yesno

返回示例

json
{
  "ok": true,
  "data": [
    {
      "id": "mail_abc123",
      "messageId": "<message-id@example.com>",
      "from": "sender@example.com",
      "fromName": "Sender",
      "to": "user@example.com",
      "toDomain": "example.com",
      "forwarded": false,
      "subject": "Invoice May",
      "preview": "Your invoice is ready",
      "text": "Your invoice is ready.",
      "html": "<p>Your invoice is ready.</p>",
      "attachments": [
        {
          "id": "att_abc123",
          "filename": "invoice.pdf",
          "mimeType": "application/pdf",
          "size": 102400,
          "contentId": "",
          "disposition": "attachment",
          "stored": true
        }
      ],
      "hasAttachments": true,
      "attachmentCount": 1,
      "size": 188000,
      "receivedAt": "2026-05-06T10:00:00.000Z"
    }
  ],
  "pagination": {
    "limit": 20,
    "nextCursor": "eyJyZWNlaXZlZEF0IjoiMjAyNi0wNS0wNlQxMDowMDowMC4wMDBaIiwiaWQiOiJtYWlsX2FiYzEyMyJ9",
    "hasMore": true
  }
}

邮件字段

字段类型说明
idstring邮件 ID,用于创建共享链接和下载附件
messageIdstring原始邮件 Message-ID
fromstring发件邮箱
fromNamestring发件人显示名
tostring收件邮箱
toDomainstring收件域名
forwardedboolean是否来自转发邮件识别
subjectstring主题
previewstring正文摘要
textstring纯文本正文
htmlstringHTML 正文
attachmentsarray附件元信息
hasAttachmentsboolean是否有附件
attachmentCountnumber附件数量
sizenumber原始邮件大小,单位字节
receivedAtstring接收时间,ISO 8601

附件字段

字段类型说明
idstring附件 ID
filenamestring文件名
mimeTypestring文件 MIME 类型
sizenumber文件大小,单位字节
contentIdstring内联附件 Content-ID,没有则为空
dispositionstringattachmentinline
storedboolean是否已保存到 R2;只有 true 才能下载

公开接口没有单封邮件详情接口,列表接口已经返回正文和附件元信息。

Released under the MIT License.