Getting Started
Set up your first inbox in under a minute.
Quick start
- Open the inbox and click Create temporary inbox.
- Copy the address from the top bar.
- Send mail to it from any app.
- Watch it appear in real time.
That's it. Everything below is for using the API or hooking up your own domains.
DNS & MX setup
If you're hosting on your own domain, point an MX record at the server.
| Type | Name | Value | TTL |
|---|---|---|---|
| A | api.you.com | your-server-ip | 3600 |
| A | mercure.you.com | your-server-ip | 3600 |
| A | mail.you.com | your-server-ip | 3600 |
| MX | @ | 10 mail.you.com | 3600 |
Behind Cloudflare? Set those records to DNS-only (grey cloud) โ proxy mode breaks ACME and SSE. Set the IP's reverse DNS (PTR) to mail.you.com in your VPS panel.
Send a test message
# Install swaks
sudo apt install swaks
# Send a test (uses MX lookup)
swaks --to test@your-domain.com \
--from probe@example.com
If the recipient exists, you'll see 250 Message Queued and the message appears in the inbox within a second.
REST API
The API surface mirrors mail.tm โ existing clients (including @cemalgnlts/mailjs) work with just a baseUrl override.
# 1. List domains
curl https://api.you.com/domains
# 2. Create an inbox
curl -X POST https://api.you.com/accounts \
-H 'Content-Type: application/json' \
-d '{"address":"test@your-domain.com","password":"secret"}'
# 3. Get a token
curl -X POST https://api.you.com/token \
-H 'Content-Type: application/json' \
-d '{"address":"test@your-domain.com","password":"secret"}'
# 4. Read messages
curl https://api.you.com/messages \
-H "Authorization: Bearer $TOKEN"
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /domains | List active domains |
| POST | /accounts | Create an inbox |
| POST | /token | Login |
| GET | /me | Account info |
| GET | /messages | Inbox listing |
| GET | /messages/:id | Full message + body + attachments |
| PATCH | /messages/:id | Mark seen / unseen |
| DELETE | /messages/:id | Delete |
| GET | /sources/:id | Raw RFC 822 |
| GET | /messages/:id/attachments/:aid/download | Stream attachment |
Real-time SSE
No polling. Subscribe to the Mercure hub with the same JWT you got from /token:
const es = new EventSource(
`https://mercure.you.com/.well-known/mercure?topic=/accounts/${id}`,
{ headers: { Authorization: `Bearer ${token}` } }
);
es.onmessage = (e) => console.log("new mail:", JSON.parse(e.data));
Use the Mailjs client
Drop-in mail.tm client, point it at your server:
import Mailjs from "@cemalgnlts/mailjs";
const mailjs = new Mailjs({
baseUrl: "https://api.you.com",
baseMercure: "https://mercure.you.com/.well-known/mercure",
});
const acc = await mailjs.createOneAccount();
mailjs.on("arrive", (m) => console.log("new mail:", m.subject));