> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/mailtrap.md).

# Mailtrap

Inspect Email Sandbox messages and send transactional email.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector            | Authentication |
| -------------------- | -------------- |
| Mailtrap (API Token) | API Token      |

#### Mailtrap (API Token)

Inspect Email Sandbox messages and send live transactional email through Mailtrap.

**Set up in Mailtrap**

1. Prepare the Mailtrap account or service that the workflow will access. Grant access to the required resources and operations.
2. **API Token:** In Mailtrap, open Settings > API Tokens and create a token with sandbox read access. Add destroy or sending permission only for actions you will use.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Mailtrap (API Token)**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field | Required | What to enter                                                                                                                                                                                                  |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API Token     | Yes      | In Mailtrap, open Settings > API Tokens and create a token with sandbox read access. Add destroy or sending permission only for actions you will use. [Provider instructions](https://mailtrap.io/api-tokens). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Mailtrap** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### List Inboxes

List Mailtrap Email Sandboxes without exposing SMTP credentials.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field           | Type          | Description                                       |
| --------------- | ------------- | ------------------------------------------------- |
| Email Sandboxes | object\_array | Mailtrap Email Sandboxes available to this token. |

#### List Inbox Messages

List captured messages in a Mailtrap Email Sandbox.

**Inputs**

| Field  | Type            | Required | Description                                                                   |
| ------ | --------------- | -------- | ----------------------------------------------------------------------------- |
| Inbox  | select (string) | Yes      | Mailtrap Email Sandbox to inspect. Options load from the selected connection. |
| Search | string          | No       | Match subject or recipient name/address.                                      |
| Cursor | string          | No       | Resume after a prior message ID.                                              |

**Outputs**

| Field       | Type          | Description                        |
| ----------- | ------------- | ---------------------------------- |
| Messages    | object\_array | Captured sandbox message metadata. |
| Next Cursor | string        | Cursor for the next bounded batch. |

#### Get Message Details

Get safe metadata for one captured sandbox message.

**Inputs**

| Field      | Type            | Required | Description                                                                      |
| ---------- | --------------- | -------- | -------------------------------------------------------------------------------- |
| Inbox      | select (string) | Yes      | Email Sandbox containing the message. Options load from the selected connection. |
| Message ID | string          | Yes      | Captured message to retrieve.                                                    |

**Outputs**

| Field   | Type   | Description                     |
| ------- | ------ | ------------------------------- |
| Message | object | Safe captured-message metadata. |

#### Delete Message

Permanently delete one captured sandbox message after confirmation.

**Inputs**

| Field                    | Type            | Required | Description                                                                      |
| ------------------------ | --------------- | -------- | -------------------------------------------------------------------------------- |
| Inbox                    | select (string) | Yes      | Email Sandbox containing the message. Options load from the selected connection. |
| Message ID               | string          | Yes      | Captured message to permanently delete.                                          |
| Confirm Permanent Delete | boolean         | Yes      | Confirm that this captured message may be deleted permanently. Default: false.   |

**Outputs**

| Field              | Type    | Description                            |
| ------------------ | ------- | -------------------------------------- |
| Deleted Message ID | integer | ID of the permanently deleted message. |

#### Send Transactional Email

Send real transactional email through Mailtrap after explicit confirmation.

**Inputs**

| Field                 | Type     | Required | Description                                          |
| --------------------- | -------- | -------- | ---------------------------------------------------- |
| Sender Email          | string   | Yes      | Address on a verified Mailtrap sending domain.       |
| Sender Name           | string   | No       | Friendly sender name.                                |
| To                    | string   | Yes      | Comma-separated live recipient addresses.            |
| CC                    | string   | No       | Optional comma-separated CC addresses.               |
| BCC                   | string   | No       | Optional comma-separated BCC addresses.              |
| Subject               | string   | Yes      | Email subject.                                       |
| Plain Text            | textarea | No       | Plain-text message body.                             |
| HTML                  | textarea | No       | Optional HTML message body.                          |
| Reply-To              | string   | No       | Optional reply address.                              |
| Confirm Live Delivery | boolean  | Yes      | Confirm delivery to real recipients. Default: false. |

**Outputs**

| Field           | Type          | Description                              |
| --------------- | ------------- | ---------------------------------------- |
| Message IDs     | string\_array | Mailtrap IDs for accepted deliveries.    |
| Recipient Count | integer       | Number of accepted recipient deliveries. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/mailtrap.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
