AgentSkillsCN

mail-tm

为代理管理的邮件工作流集成 Mail.tm 临时邮箱 API。当 Codex 需要创建、验证、读取并管理临时邮箱时使用此 API,支持持久化邮箱模式(定期使用同一邮箱)以及一次性邮箱模式(按需创建并随时丢弃)。

SKILL.md
--- frontmatter
name: mail-tm
description: Integrate Mail.tm temporary email API for agent-managed email workflows. Use when Codex needs to create, authenticate, read, and manage temporary mailboxes, including a persistent mailbox mode (reuse one mailbox with periodic activity) and a throwaway mode (create and discard on demand).

Mail.tm Skill

Agent-first integration for temporary email addresses. Supports two modes: A) Persistent mailbox mode (reuse one mailbox with periodic activity to reduce expiry risk) B) Throwaway mode (create once, receive a code, then abandon)

Skill version: 1.0.0
API base: https://api.mail.tm
SSE base: https://mercure.mail.tm/.well-known/mercure

Every request except POST /accounts and GET /domains requires a Bearer token. (docs.mail.tm)


Quick Start

Step 1 - Fetch available domains

bash
curl https://api.mail.tm/domains

Returns hydra:member with available domains. (docs.mail.tm)

Step 2 - Create an account

bash
curl -X POST https://api.mail.tm/accounts \
  -H "Content-Type: application/json" \
  -d '{"address":"user@domain.com","password":"secret"}'

The address must use a domain from GET /domains. (docs.mail.tm)

Step 3 - Obtain a token

bash
curl -X POST https://api.mail.tm/token \
  -H "Content-Type: application/json" \
  -d '{"address":"user@domain.com","password":"secret"}'

The response contains token. Use Authorization: Bearer TOKEN for all subsequent requests. (docs.mail.tm)

Step 4 - List messages

bash
curl https://api.mail.tm/messages \
  -H "Authorization: Bearer TOKEN"

Mode A: Persistent Mailbox Mode

Goal: Maintain a stable mailbox address and reuse it for registrations and communication.

  1. Create the account and store address and password.
  2. Periodically call GET /messages or listen via SSE to keep activity on the account.
  3. Share the mailbox address with the owner so they can communicate with it.
  4. When a service requires email registration, reuse this address to receive codes and complete the flow.

Note: Mail.tm does not document an explicit renewal or keep-alive API. Periodic access is a best-effort strategy, not an official guarantee. (docs.mail.tm)


Mode B: Throwaway Mode

Goal: Create a mailbox once for a verification code and do not maintain it.

  1. Call GET /domains, generate a random local-part, and create the account.
  2. Use POST /token to obtain a token.
  3. Poll GET /messages or use SSE to retrieve the verification email.
  4. Stop using the account after the code is received; do not keep it active.

First Boot Protocol

  1. Fetch GET /domains to see available domains.
  2. Create one account and obtain a token to validate auth flow.
  3. Use GET /messages to confirm mailbox access.
  4. Switch to SSE when real-time updates are needed.
  5. Choose Mode A or Mode B per business context.

SSE (Real-time Messages)

Mail.tm uses Mercure SSE, not webhooks. (docs.mail.tm)

text
Base URL: https://mercure.mail.tm/.well-known/mercure
Topic: /accounts/{id}
Headers: Authorization: Bearer TOKEN

Each new message triggers an account event. (docs.mail.tm)


Error Handling


Rate Limit and Rules


Minimal Endpoint Map

text
GET    https://api.mail.tm/domains
POST   https://api.mail.tm/accounts
POST   https://api.mail.tm/token
GET    https://api.mail.tm/messages
GET    https://api.mail.tm/messages/{id}
PATCH  https://api.mail.tm/messages/{id}
DELETE https://api.mail.tm/messages/{id}
GET    https://api.mail.tm/sources/{id}