---
title: "Sending and replying"
description: "New messages and replies from an inbox: the fields, quoting, attachments and inline images, multipart bodies, idempotent retries, the limits, and what a refused send answers."
url: https://doorman.fyi/docs/sending
markdown: https://doorman.fyi/docs/sending.md
area: "Guides"
section: "Mail"
---

# Sending and replying

New messages and replies from an inbox: the fields, quoting, attachments and inline images, multipart bodies, idempotent retries, the limits, and what a refused send answers.

Source: https://doorman.fyi/docs/sending

## Sending a message

[`POST /v1/inboxes/{inboxId}/send`](https://doorman.fyi/docs/reference/sending.md#inboxes-send) sends from the inbox's address, with the inbox's display name as the sender name. It works with an account key and with the inbox's own key. A new message needs `to` and `subject`; everything else is optional.

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/send" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "to": "sam@example.com",
    "subject": "Thursday",
    "text": "Thursday works."
  }'
```

- `to`, `cc`, `bcc`: One address, several separated by commas, or an array. At most 50 addresses across the three.
- `subject`: At most 998 characters. Required on a new message; a reply defaults to `Re: <thread subject>`.
- `text`, `html`: The plain-text and HTML bodies, each at most 2,000,000 characters. Text is derived from the HTML when only `html` is given.
- `body`: A convenience: treated as HTML when it looks like HTML, as text otherwise. Ignored when `text` or `html` is given.
- `replyTo`: The address replies should go to instead of the inbox.
- `attachments`: Files to attach, below.
- `threadId`, `includeQuote`: What makes the message a reply, below.

The answer is `201` with the stored outbound message, a [`SentMessage`](https://doorman.fyi/docs/reference/schemas.md#SentMessage): the same shape as any message, `direction` `outbound`, plus `providerMessageId`, the identifier the sending provider assigned. Outbound messages are stored without a raw copy, so their `rawUrl` is null.

201 Created:
```json
{
  "id": "msg_01jc5b7h8j9k0m1n2p3q4r5s6t",
  "inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
  "threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
  "direction": "outbound",
  "rfcMessageId": null,
  "inReplyTo": "<a1b2c3@example.com>",
  "references": [
    "<a1b2c3@example.com>"
  ],
  "from": {
    "address": "concierge@doorman.example",
    "name": "Acme concierge"
  },
  "to": [
    {
      "address": "sam@example.com",
      "name": null
    }
  ],
  "cc": [],
  "bcc": [],
  "replyTo": null,
  "deliveryRole": null,
  "subject": "Re: Invoice 2847",
  "text": "Thanks, confirming for Thursday.",
  "hasHtml": false,
  "rawUrl": null,
  "sizeBytes": 31,
  "category": "personal",
  "autoReplyable": false,
  "verdict": null,
  "spamScore": null,
  "authentication": null,
  "occurredAt": "2026-11-05T10:05:00.000Z",
  "attachments": [],
  "providerMessageId": "<b2c3d4@doorman.example>"
}
```

## Replying in a thread

A reply is a send with a `threadId`. The thread supplies what a mail client would:

- the subject, `Re: <thread subject>`, unless you pass one;
- the `In-Reply-To` and `References` headers, so the recipient's client keeps the conversation together;
- the recipient, the last inbound message's `Reply-To` or its sender, unless you pass `to`;
- the previous message, quoted under your text, unless `includeQuote` is false.

Sending a reply marks the thread read. A thread that does not exist, belongs to another inbox or was trashed answers `404 thread_not_found`.

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/send" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -H "idempotency-key: order-2847-reply" \
  -H "content-type: application/json" \
  -d '{
    "threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m",
    "text": "Thanks, confirming for Thursday.",
    "includeQuote": true
  }'
```

## Attachments and inline images

`attachments` is an array of [`SendAttachment`](https://doorman.fyi/docs/reference/schemas.md#SendAttachment): `filename`, `contentType` and `content` as base64. Up to 32 per message, and the whole message, text, HTML and decoded attachments together, may be 25 MiB at most.

An image shown inside the HTML body is an inline attachment: set `disposition` to `inline` and give it a `contentId`, then reference it from the HTML as `cid:<contentId>`.

A message with an inline image:
```json
{
  "to": "sam@example.com",
  "subject": "The chart",
  "html": "<p>This week's chart:</p><img src=\"cid:chart-1\">",
  "attachments": [
    {
      "filename": "chart.png",
      "contentType": "image/png",
      "content": "iVBORw0KGgo...",
      "disposition": "inline",
      "contentId": "chart-1"
    }
  ]
}
```

Any type of file can be attached within that size; a larger file, a long video for example, travels as a link. Every attachment is checked by its bytes before the message leaves, and where security policies are enforced some are refused: a program or a file dressed as another kind for every caller, and a locked, damaged or macro-carrying file for keys and app tokens ([Outbound guards](https://doorman.fyi/docs/security.md#guards)). The stored message lists each attachment with the `scan` the check gave it.

## Sending as multipart/form-data

The same route accepts `multipart/form-data`, which spares an agent the base64 step for large files: the text fields keep their names, each file goes in a repeated `attachments` field, and `includeQuote` is text (`false`, `0` or `no` turn the quote off). A body that cannot be parsed answers `400 invalid_form`.

curl:
```sh
curl -s -X POST "https://api.doorman.fyi/v1/inboxes/inb_01jc4q7w9k2m5n8p3r6t1v4x7z/send" \
  -H "authorization: Bearer $DOORMAN_API_KEY" \
  -F "to=sam@example.com" \
  -F "subject=The report" \
  -F "text=The report is attached." \
  -F "attachments=@report.pdf;type=application/pdf"
```

## Idempotent retries

Networks fail after a request was handled. Send an `Idempotency-Key` header (1 to 255 printable ASCII characters, `^[!-~]{1,255}$`) and a retry is safe for 24 hours:

- the same key with the same request replays the original answer, with the header `Idempotent-Replayed: true`, and nothing is sent again;
- the same key with a different request is refused with `422 idempotency_key_reused`;
- a key whose first attempt is still running answers `409 idempotency_in_progress`;
- a failed send releases the key, so the same key can be retried after the cause is fixed.

Keys are per inbox. Derive them from what the send is about, such as the order or the thread and the step, rather than from a timestamp. [Idempotency](https://doorman.fyi/docs/idempotency.md) has how each SDK, the command line and the MCP server pass the key.

## Limits

| Limit | Value | When it is reached |
| --- | --- | --- |
| Sends per minute, per inbox | 10 | `429 rate_limit_exceeded` with `Retry-After`, `scope: "inbox"`, `limit` and `resetsAt`. Refused sends are not counted. |
| Sends per UTC day, per inbox | 200 | The same `429`. |
| Sends per UTC day, per account, every plan | 500 across all inboxes; 20 while the account is younger than 7 days | `429 rate_limit_exceeded` with `Retry-After`, `scope: "account"`, `limit` and `resetsAt`. The shared domain's sending reputation is everyone's, so the cap does not depend on the plan. |
| Sends per month, Free plan | 3000 per account, replies included | `402 plan_limit_reached` with `scope: "account"`, `plan`, `limit`, `used` and `resetsAt`, the first instant of the next month. No `Retry-After`: upgrade rather than wait. |
| Recipients | 50 across to, cc and bcc | `400 validation_error`. |
| Attachments | 32 | `400 validation_error`. |
| Message size | 25 MiB, attachments decoded | `413 message_too_large`. |
| Subject | 998 characters | `400 validation_error`. |
| Each body field | 2,000,000 characters | `400 validation_error`. |

> Note: The per-minute and per-day counters are abuse protection rather than exact accounting; two sends arriving at the same instant can both pass the check at the limit. The Unlimited plan has no monthly cap.

## When a send is refused

The API maps the sending provider's outcomes to its own codes and never echoes the provider's message. `providerCode` carries the provider's reason where there is one.

| Status | Error | Meaning |
| --- | --- | --- |
| 400 | `recipient_suppressed` | A recipient previously bounced or complained and is suppressed. |
| 403 | `recipient_not_permitted` | A recipient is not permitted for this deployment. |
| 413 | `message_too_large` | The message exceeds the size limit, including attachments. |
| 400 | `send_rejected` | The sending provider rejected the message; `providerCode` carries its reason. |
| 429 | `provider_rate_limited` | The sending provider is rate limiting this deployment. |
| 503 | `sending_paused` | Sending is paused for this deployment pending review. |
| 503 | `sending_unavailable` | The inbox domain is not onboarded for sending, or sending is not configured. |
| 502 | `send_failed` | The sending provider did not accept or could not deliver the message; `providerCode` carries its reason. |

Before the provider is involved: `400 validation_error` names the field, `400 invalid_json` and `invalid_form` mean the body could not be read, `403 risk_blocked` (with `guard` set to `reply` or `recipient`) means the [security policy](https://doorman.fyi/docs/security.md#guards) blocked an agent reply in a flagged thread or a send to an unknown recipient, `403 risk_blocked` with `guard` set to `content` means an attachment or a link did not pass its check and `reasons` says why, `503 scan_unavailable` means an attachment could not be checked in time and the send is safe to repeat after `Retry-After`, `404 thread_not_found` covers a reply to a thread that is not the inbox's, and `403 inbox_suspended` means the inbox cannot send at the moment. The [reference entry](https://doorman.fyi/docs/reference/sending.md#inboxes-send) lists every code the route answers.
