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

# Mailtrap

> Integrate your application with the Mailtrap API

## 🚀 Quickstart

Connect to Mailtrap with Nango and see data flow in 2 minutes.

**1. Create the integration**

In Nango ([free signup](https://app.nango.dev)), go to [Integrations](https://app.nango.dev/dev/integrations) -> *Configure New Integration* -> *Mailtrap*.

**2. Authorize Mailtrap**

Go to [Connections](https://app.nango.dev/dev/connections) -> *Add Test Connection* -> *Authorize*, then enter your API token. Leave the API Environment on `send`, or switch it to `sandbox` to test without sending to real recipients. Later, you'll let your users do the same directly from your app.

**3. Call the Mailtrap API**

Let's send your first email through the Mailtrap API. Replace the placeholders below with your [Environment API key](https://nango.dev/docs/reference/backend/http-api/api-keys.md), [integration ID](https://app.nango.dev/dev/integrations), and [connection ID](https://app.nango.dev/dev/connections):

> [!TIP]
>
> **Connected to the sandbox?** Include your sandbox inbox ID in the request path, e.g. `/api/send/{inboxId}` instead of `/api/send`. See [Sandbox inbox IDs](#sandbox-inbox-ids).

**cURL**

```bash theme={null}
curl "https://api.nango.dev/proxy/api/send" \
  -H "Authorization: Bearer <NANGO-API-KEY>" \
  -H "Provider-Config-Key: <INTEGRATION-ID>" \
  -H "Connection-Id: <CONNECTION-ID>" \
  -H "Content-Type: application/json" \
  -d '{
    "from": { "email": "sender@yourdomain.com" },
    "to": [{ "email": "recipient@example.com" }],
    "subject": "Hello from Nango",
    "text": "This is a test email sent through Mailtrap."
  }'
```

**Node**

Install Nango's backend SDK with `npm i @nangohq/node`. Then run:

```typescript theme={null}
import { Nango } from '@nangohq/node';

const nango = new Nango({ apiKey: '<NANGO-API-KEY>' });

const res = await nango.post({
    endpoint: '/api/send',
    providerConfigKey: '<INTEGRATION-ID>',
    connectionId: '<CONNECTION-ID>',
    data: {
        from: { email: 'sender@yourdomain.com' },
        to: [{ email: 'recipient@example.com' }],
        subject: 'Hello from Nango',
        text: 'This is a test email sent through Mailtrap.'
    }
});

console.log(res.data);
```

Or fetch credentials with the [Node SDK](https://nango.dev/docs/reference/sdks/node.md#get-a-connection-with-credentials) or [API](https://nango.dev/docs/reference/api/connection/get.md).

✅ You're connected! Check the [Logs](https://app.nango.dev/dev/logs) tab in Nango to inspect requests.

**4. Implement Nango in your app**

Follow our [Auth implementation guide](https://nango.dev/docs/guides/primitives/auth.md) to integrate Nango in your app.

To obtain your own production API token, follow the connect guide linked below.

## Sandbox inbox IDs

Sandbox connections deliver to a Mailtrap inbox instead of real recipients, so the inbox ID belongs in the request path: `/api/send/{inboxId}`.

To find it, open the [Sandboxes](https://mailtrap.io/sandboxes/projects) section of your Mailtrap account and copy the numeric ID from the inbox URL — for `https://mailtrap.io/sandboxes/2564102/settings` the inbox ID is `2564102`.

> **For agents**
>
> Inbox IDs can also be listed through the Nango proxy. These are Nango API calls, so they need the user's own Nango Environment API key from the **Environment Settings** tab > **API Keys** (signing up at [app.nango.dev/signup](https://app.nango.dev/signup) first if needed), sent as `Authorization: Bearer <NANGO-API-KEY>`. Ask for a key scoped to `environment:proxy` rather than the full-access key created on signup, and don't store or log it. See [API keys](https://nango.dev/docs/reference/backend/http-api/api-keys.md).
>
> Mailtrap's inbox API lives on `mailtrap.io`, not on the sending hosts this integration connects to, so pass a `Base-Url-Override` header to reach it:
>
> ```bash theme={null}
> # 1. List accounts to get your account ID
> curl "https://api.nango.dev/proxy/api/accounts" \
>   -H "Authorization: Bearer <NANGO-API-KEY>" \
>   -H "Provider-Config-Key: <INTEGRATION-ID>" \
>   -H "Connection-Id: <CONNECTION-ID>" \
>   -H "Base-Url-Override: https://mailtrap.io"
>
> # 2. List that account's inboxes — each has an `id` to use as {inboxId}
> curl "https://api.nango.dev/proxy/api/accounts/<ACCOUNT-ID>/inboxes" \
>   -H "Authorization: Bearer <NANGO-API-KEY>" \
>   -H "Provider-Config-Key: <INTEGRATION-ID>" \
>   -H "Connection-Id: <CONNECTION-ID>" \
>   -H "Base-Url-Override: https://mailtrap.io"
> ```
>
> `Base-Url-Override` is enabled by default and can be restricted or disabled per deployment via `NANGO_PROXY_BASE_URL_OVERRIDE_ENABLED` / `NANGO_PROXY_BASE_URL_OVERRIDE_DENYLIST`.

## 📚 Mailtrap Integration Guides

Nango-maintained guides for common use cases.

* [How to obtain your Mailtrap credentials](https://nango.dev/docs/api-integrations/mailtrap/connect)
  Get your API token, and pick the production or sandbox API environment, to connect Mailtrap to Nango

Official docs: [Mailtrap Transactional Email API](https://docs.mailtrap.io/developers/email-sending/transactional)

## 🧩 Pre-built syncs & actions for Mailtrap

Explore Nango-provided actions in your dashboard. Extend and customize them to fit your needs.

*No pre-built syncs or actions available yet.*

> [!TIP]
>
> Not seeing the integration you need? [Build your own](https://nango.dev/docs/guides/functions/functions-guide.md) independently.

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.