TempMail

API 文件

TempMail API v1 參考

基礎 URL

https://mail.taohuaxin.top

認證

除 /config 外的所有端點都需要認證。

在所有請求中新增以下標頭:

x-api-key: tm_your_token_here

取得您的權杖:儀表板 → 設定 → API 金鑰

端點

方法路徑說明
GET/api/v1/config伺服器設定(公開 — 無需認證)
GET/api/v1/me擷取所有信箱的郵件(長輪詢)
GET/api/v1/inbox/:address擷取單一信箱的郵件(長輪詢)
DELETE/api/v1/inbox/:address清除信箱中的所有郵件
GET/api/v1/email/:id取得完整解析的郵件(文字 + HTML + 附件)
GET/api/v1/email/:id/rendered取得渲染後的郵件文字
GET/api/v1/email/:id/attachments/:attachmentId依附件 ID 下載單一附件
DELETE/api/v1/email/:id刪除單一郵件
GET/api/v1/domains列出您的自訂網域
POST/api/v1/domains新增自訂網域
DELETE/api/v1/domains/:id移除自訂網域

docs.examples

GET/api/v1/config

伺服器設定(公開 — 無需認證)

curl https://mail.taohuaxin.top/api/v1/config

docs.response

{
  "domains": ["taohuaxin.top"],
  "smtpPort": 25,
  "smtpsPort": 465,
  "mxPort": 25,
  "version": "1.0.0"
}
GET/api/v1/me

擷取所有信箱的郵件(長輪詢)

curl -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/me?count=1&limit=20"

docs.response

{
  "emails": [
    {
      "id": "cmcg2a1b40001xyz",
      "fromAddress": "[email protected]",
      "subject": "Your verification code",
      "isRead": false,
      "receivedAt": "2026-07-10T08:30:00.000Z",
      "mailbox": { "address": "alice", "domain": "taohuaxin.top" }
    }
  ],
  "nextSince": "cmcg2a1b40001xyz"
}
GET/api/v1/inbox/:address

擷取單一信箱的郵件(長輪詢)

curl -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/inbox/[email protected]?since=cmcg2a1b40001xyz&count=1"

docs.response

{
  "emails": [
    {
      "id": "cmcg9f2c80002abc",
      "fromAddress": "[email protected]",
      "subject": "Welcome!",
      "isRead": false,
      "receivedAt": "2026-07-10T09:00:00.000Z"
    }
  ],
  "nextSince": "cmcg9f2c80002abc"
}
DELETE/api/v1/inbox/:address

清除信箱中的所有郵件

curl -X DELETE -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/inbox/[email protected]"

docs.response

{ "success": true }
GET/api/v1/email/:id

取得完整解析的郵件(文字 + HTML + 附件)

curl -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/email/cmcg2a1b40001xyz"

docs.response

{
  "id": "cmcg2a1b40001xyz",
  "fromAddress": "[email protected]",
  "toAddress": "[email protected]",
  "subject": "Your verification code",
  "bodyHtml": "<p>Your code is <b>123456</b></p>",
  "bodyText": "Your code is 123456",
  "isRead": true,
  "receivedAt": "2026-07-10T08:30:00.000Z",
  "attachments": [
    { "id": "att_01", "filename": "invoice.pdf", "mimeType": "application/pdf", "size": 24580 }
  ]
}
GET/api/v1/email/:id/rendered

取得渲染後的郵件文字

curl -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/email/cmcg2a1b40001xyz/rendered"

docs.response

From: [email protected]
To: [email protected]
Subject: Your verification code
Date: Fri, 10 Jul 2026 08:30:00 GMT

<p>Your code is <b>123456</b></p>
GET/api/v1/email/:id/attachments/:attachmentId

依附件 ID 下載單一附件

curl -OJ -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/email/cmcg2a1b40001xyz/attachments/att_01"

docs.response

HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="invoice.pdf"
Content-Length: 24580

<binary file stream>
DELETE/api/v1/email/:id

刪除單一郵件

curl -X DELETE -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/email/cmcg2a1b40001xyz"

docs.response

{ "success": true }
GET/api/v1/domains

列出您的自訂網域

curl -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/domains"

docs.response

[
  {
    "id": "dom_01",
    "domain": "mail.example.com",
    "verified": true,
    "receiveMode": "inherit",
    "createdAt": "2026-07-01T00:00:00.000Z"
  }
]
POST/api/v1/domains

新增自訂網域

curl -X POST -H "x-api-key: tm_your_token_here" \
  -H "Content-Type: application/json" \
  -d '{"domain":"mail.example.com","receiveMode":"inherit"}' \
  "https://mail.taohuaxin.top/api/v1/domains"

docs.response

{
  "id": "dom_02",
  "domain": "mail.example.com",
  "verified": false,
  "receiveMode": "inherit",
  "createdAt": "2026-07-10T10:00:00.000Z"
}
DELETE/api/v1/domains/:id

移除自訂網域

curl -X DELETE -H "x-api-key: tm_your_token_here" \
  "https://mail.taohuaxin.top/api/v1/domains/dom_02"

docs.response

{ "success": true }

長輪詢

信箱端點支援長輪詢。呼叫一次後伺服器會持續等待直到郵件到達(最長 25 秒)。若超時無郵件則返回 204。

查詢參數

參數說明
since前次回應的游標;僅返回此時間之後的郵件
count累積 N 封新郵件後返回(預設 1,最大 50)
limit每頁回應的最大郵件數(預設 20,最大 50)
from篩選 — 僅返回寄件人包含此子字串的郵件
subject篩選 — 僅返回主旨包含此子字串的郵件

刪除行為

所有 DELETE 操作均為軟刪除:已刪除的項目對使用者隱藏,但仍可供管理員稽核查看。