rootmail

Sending

Messages

Send email — inline or templated — and read its full lifecycle back.

A message is a single email to a single recipient. Send inline HTML, or reference a template by slug or id and pass variables.

Send a message

POST/v1/messages
torequiredstringRecipient address, or { email, name }.
subjectstringRequired unless the template supplies one.
html / textstringInline body. Omit when using a template.
templatestringA template slug. Use template_id for the id.
variablesobjectValues merged into the template (Handlebars).
from / reply_tostringOverride the sender / reply-to (must be a verified sender).
typeenum`transactional` (default) or `marketing` — meters against the right wing.
send_atstringISO 8601 — schedule for later instead of sending now.
idempotency_keystringExactly-once — see Idempotency.
tags / metadataarray / objectYour own labels; echoed back on events.
send-template.ts
const msg = await mail.messages.create({
  to: { email: "ada@example.com", name: "Ada" },
  template: "welcome",
  variables: { name: "Ada", action_url: "https://acme.com/start" },
  tags: ["onboarding"],
  idempotencyKey: `welcome-${user.id}`,
});
// → { id: "msg_…", status: "queued", … }

Retrieve, audit & prove

GET/v1/messages
GET/v1/messages/:id
GET/v1/messages/:id/audit
GET/v1/messages/:id/proof
audit.ts
const { trail } = await mail.messages.audit(msg.id);
// queued → sending → sent → delivered → opened …
const proof = await mail.messages.proof(msg.id); // { bundle, signature }
noteSuppressed, bounced, and unsubscribed recipients are checked automatically before every send — you can't accidentally email someone who opted out.