---
title: "Send email"
method: POST
path: "/mailboxes/v1/{mailbox_id}/messages"
tags: ["Mailboxes"]
---

# Send email

`POST /mailboxes/v1/{mailbox_id}/messages`

## Request

- Base URL: `https://api.run402.com`
- URL: `https://api.run402.com/mailboxes/v1/{mailbox_id}/messages`
- Auth: HTTP bearer

Sends an email from the mailbox. Supports two modes: template mode (provide template + variables) or raw HTML mode (provide subject + html). The from_name field optionally sets a display name on the From header. Same-domain sends are normal accounted outbound sends through the provider path; Run402 does not short-circuit loopback delivery. Raw mode accepts subject plus text without html; when text is supplied, it is the first text/plain body part and footer policy appends only. Attachments are decoded once from content_base64 before transport MIME encoding.

## Path parameters

- `mailbox_id` string, uuid, required

## Request body

- object
  - `to` string, email, required: Recipient email address
  - `template` 'project_invite' | 'magic_link' | 'notification': Email template to use (template mode)
  - `variables` object: Template variables (template mode)
  - `subject` string: Email subject line (raw mode)
  - `html` string: HTML email body, max 1MB (raw mode)
  - `text` string: Optional plaintext fallback; auto-generated from html if omitted (raw mode)
  - `from_name` string: Display name for the From header, e.g. 'My App' renders as '"My App" <slug@project-host.mail.run402.com>' or the ready custom-domain address.

## Response `201`

Message sent

- MailboxMessage
  - `message_id` string
  - `mailbox_id` string: Mailbox that actually sent the message.
  - `from_address` string, email: Sender address actually used.
  - `to` string, email
  - `template` 'project_invite' | 'magic_link' | 'notification'
  - `status` string
  - `sent_at` string, date-time

## Other responses

- `401`: Missing or invalid authentication. Run402-originated JSON bodies use the canonical ErrorEnvelope.

---

[API](https://skmtc.dev/run402/apis/run402-api.md) · [All operations](https://skmtc.dev/run402/apis/run402-api/llms.txt) · [OpenAPI document](https://skmtc.dev/run402/apis/run402-api/revisions/893607557f50?raw)
