> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentpost.email/llms.txt
> Use this file to discover all available pages before exploring further.

# Message Tools

> MCP tools for reading, waiting for, deleting, downloading attachments from, and sending email messages.

## ReadEmail

Reads the full content of a specific email message. You must own the message's mailbox.

**Inputs**

<ParamField path="message_id" type="string" required>
  The UUID of the message to read.
</ParamField>

<ParamField path="format" type="string">
  Response format for message content. Options: `text`, `html`, `html2text`. Defaults to `"html2text"`.

  * `html2text` — HTML converted to clean readable text preserving links and structure. Recommended for AI agents (minimal tokens, preserves structure).
  * `text` — original plain text part.
  * `html` — both plain text and full HTML content.
</ParamField>

**Output**

<ResponseField name="id" type="string">
  The message UUID.
</ResponseField>

<ResponseField name="subject" type="string">
  Email subject line.
</ResponseField>

<ResponseField name="from" type="string">
  Sender address.
</ResponseField>

<ResponseField name="to" type="array">
  List of recipient addresses.
</ResponseField>

<ResponseField name="cc" type="array">
  List of CC addresses.
</ResponseField>

<ResponseField name="date" type="string">
  ISO 8601 timestamp of when the email was sent.
</ResponseField>

<ResponseField name="text_content" type="string">
  Message body in the requested format. When using `html` format, `html_content` is also included.
</ResponseField>

<ResponseField name="thread_id" type="string">
  The conversation thread this message belongs to.
</ResponseField>

<ResponseField name="thread_message_count" type="integer">
  Total number of messages in the thread. When greater than `1`, call `ReadThread` to see the full conversation.
</ResponseField>

<ResponseField name="has_attachments" type="boolean">
  Whether the message has any attachments.
</ResponseField>

<ResponseField name="attachment_count" type="integer">
  Number of attachments on the message.
</ResponseField>

<ResponseField name="attachments" type="array">
  List of attachment metadata. Each item includes `id`, `filename`, `mime_type`, and `size`. Use the `id` with `DownloadAttachment` to retrieve file content.
</ResponseField>

***

## WaitForEmail

Waits for a new email to arrive in a mailbox, streaming progress notifications while waiting. Only detects emails that arrive after the tool is called.

**Inputs**

<ParamField path="email_address" type="string" required>
  The mailbox email address to wait for.
</ParamField>

<ParamField path="timeout" type="integer">
  Maximum number of seconds to wait. Must be between 5 and 120. Defaults to `30`.
</ParamField>

<ParamField path="format" type="string">
  Response format for message content. Options: `text`, `html`, `html2text`. Defaults to `"html2text"`.
</ParamField>

**Output when an email arrives**

<ResponseField name="status" type="string">
  Always `"received"` when an email arrived within the timeout period.
</ResponseField>

<ResponseField name="id" type="string">
  The message UUID.
</ResponseField>

<ResponseField name="subject" type="string">
  Email subject line.
</ResponseField>

<ResponseField name="from" type="string">
  Sender address.
</ResponseField>

<ResponseField name="to" type="array">
  List of recipient addresses.
</ResponseField>

<ResponseField name="cc" type="array">
  List of CC addresses.
</ResponseField>

<ResponseField name="date" type="string">
  ISO 8601 timestamp of when the email was sent.
</ResponseField>

<ResponseField name="text_content" type="string">
  Message body in the requested format.
</ResponseField>

<ResponseField name="thread_id" type="string">
  The conversation thread this message belongs to. Call `ReadThread` to see the full conversation context.
</ResponseField>

<ResponseField name="has_attachments" type="boolean">
  Whether the message has any attachments.
</ResponseField>

<ResponseField name="attachment_count" type="integer">
  Number of attachments on the message.
</ResponseField>

**Output when the timeout is reached**

<ResponseField name="status" type="string">
  Always `"timeout"` when no email arrived within the timeout period.
</ResponseField>

<ResponseField name="mailbox" type="string">
  The email address that was monitored.
</ResponseField>

<ResponseField name="waited_seconds" type="integer">
  Number of seconds the tool waited before timing out.
</ResponseField>

<ResponseField name="message" type="string">
  A human-readable description of the timeout.
</ResponseField>

<Note>
  The tool streams `notifications/progress` events every 2 seconds so your agent receives confirmation it is still running. If you need to wait longer than 120 seconds, call `WaitForEmail` again after it returns.
</Note>

***

## DeleteEmail

Deletes a specific email message. You must own the message's mailbox.

<Warning>
  This action is irreversible. The message cannot be recovered after deletion.
</Warning>

**Inputs**

<ParamField path="message_id" type="string" required>
  The UUID of the message to delete.
</ParamField>

**Output**

<ResponseField name="deleted" type="boolean">
  Always `true` when the message was successfully deleted.
</ResponseField>

<ResponseField name="message_id" type="string">
  The UUID of the deleted message.
</ResponseField>

***

## DownloadAttachment

Downloads a specific email attachment and returns its content as base64. You must own the attachment's mailbox.

**Inputs**

<ParamField path="attachment_id" type="string" required>
  The UUID of the attachment to download. Obtain attachment IDs from the `attachments` array in a `ReadEmail` response.
</ParamField>

**Output**

<ResponseField name="id" type="string">
  The attachment UUID.
</ResponseField>

<ResponseField name="filename" type="string">
  Original filename of the attachment.
</ResponseField>

<ResponseField name="mime_type" type="string">
  MIME type of the attachment (e.g., `"application/pdf"`).
</ResponseField>

<ResponseField name="size" type="integer">
  File size in bytes.
</ResponseField>

<ResponseField name="content_base64" type="string">
  Base64-encoded file content.
</ResponseField>

<Note>
  Attachments larger than 10 MB return an error. Download large files directly from the AgentPost web interface instead.
</Note>

***

## SendEmail

Sends an outbound email from a mailbox on a verified custom domain. The message is queued for delivery asynchronously.

<Warning>
  The sending mailbox must exist on a custom domain in `active` or `pending_warmup` status. Domains in warmup are limited to 10 emails per day; active domains are limited to 50 emails per day (configurable). Exceeding the daily quota returns an error.
</Warning>

**Inputs**

<ParamField path="from_email_address" type="string" required>
  The full email address of the sending mailbox (e.g., `"sales@example.com"`). The mailbox must exist on a verified custom domain you own.
</ParamField>

<ParamField path="to" type="string[]" required>
  Array of recipient email addresses.
</ParamField>

<ParamField path="subject" type="string" required>
  Email subject line. Maximum 998 characters.
</ParamField>

<ParamField path="body" type="string" required>
  Plain text body of the email.
</ParamField>

<ParamField path="html_body" type="string">
  HTML body for multipart emails. When provided, recipients see HTML with the plain text `body` as a fallback.
</ParamField>

<ParamField path="in_reply_to" type="string">
  Message-ID of the email you are replying to. Threads the outbound message as a reply in the recipient's email client.
</ParamField>

<ParamField path="attachments" type="array">
  Array of attachment objects to include with the email. Maximum 20 attachments per message. Each object must include:

  * `filename` (string) — the file name (e.g., `"report.pdf"`)
  * `mime_type` (string) — MIME type (e.g., `"application/pdf"`)
  * `content_base64` (string) — base64-encoded file content

  Per-attachment size limit: **25 MB**. Total attachment size limit: **25 MB**.
</ParamField>

<Note>
  CC and BCC are not currently supported. Only direct recipients via the `to` field are accepted.
</Note>

**Output**

<ResponseField name="message_id" type="string">
  Unique identifier for the queued message.
</ResponseField>

<ResponseField name="status" type="string">
  Always `"queued"` when the message was accepted for delivery.
</ResponseField>

<ResponseField name="attachment_count" type="integer">
  Number of attachments included with the message.
</ResponseField>
