临时邮箱 API

自托管临时邮箱服务,内置 SMTP 服务器接收邮件,通过 HTTP API 管理邮箱与邮件。

DNS 配置

主域名模式

邮箱格式:random10@ticloud.tech

ticloud.tech.   MX   10   ticloud.tech.

子域名模式(泛域名)

邮箱格式:random10@random8.ticloud.tech

*.ticloud.tech.   MX   10   ticloud.tech.

注意:部分 DNS 服务商不支持通配符 MX,请确认你的 DNS 提供商支持 * 通配符记录。

API 接口

1. 创建临时邮箱

端点: GET/POST /mailbox

请求头:

Authorization: [CREATE_TOKEN(如果服务端设置了该环境变量)]

请求体(可选 JSON):

字段类型说明
domainstring指定邮箱域名,不填则随机选取
typestring"maindomain"(默认)或 "subdomain"
{
  "domain": "ticloud.tech",
  "type": "subdomain"
}

响应示例(201):

{
  "token": "550e8400-e29b-41d4-a716-446655440000",
  "mailbox": "abcdefghij@xxxxxxxx.ticloud.tech"
}

2. 获取邮件列表

端点: GET /messages

请求头:

Authorization: [邮箱 token]

响应示例(200):

{
  "mailbox": "abcdefghij@ticloud.tech",
  "messages": [
    {
      "_id": "550e8400-e29b-41d4-a716-446655440000",
      "receivedAt": 1746356501,
      "from": "sender@example.com",
      "subject": "测试邮件",
      "bodyPreview": "邮件预览内容(最多100字符)",
      "attachmentsCount": 0
    }
  ]
}

3. 获取邮件详情

端点: GET /messages/{id}

请求头:

Authorization: [邮箱 token]

响应示例(200):

{
  "_id": "550e8400-e29b-41d4-a716-446655440000",
  "receivedAt": 1746356501,
  "mailbox": "abcdefghij@ticloud.tech",
  "from": "sender@example.com",
  "subject": "测试邮件",
  "bodyPreview": "邮件预览内容",
  "bodyHtml": "<div>完整 HTML 正文</div>",
  "attachmentsCount": 0,
  "attachments": []
}

注意事项