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

# Vercel

Step-by-step guide on how to integrate Mailtrap with your application hosted on Vercel to enable email sending capabilities.

Mailtrap’s native integration with Vercel removes manual setup friction, minimizes configuration mistakes, and makes it easy to follow a reliable testing-to-production email workflow.

This integration automatically configures the environment variables necessary for both testing (Sandbox) and production sending in your Vercel projects.

{% hint style="info" %}
The integration adds a set of three variables (`API_KEY`, `USE_SANDBOX`, and `INBOX_ID`) for each of the three Vercel environments: **Development**, **Preview**, and **Production**.
{% endhint %}

#### Prerequisites

* **Admin rights** for your Mailtrap account.
* A [verified sending domain](https://docs.mailtrap.io/email-api-smtp/setup/sending-domain) set up within Mailtrap.
* An existing **Vercel account** with one or more projects.

### Step-by-step integration guide

{% stepper %}
{% step %}

#### Initiate the integration

* Log in to your Mailtrap account
* Navigate to the [**Integrations** page](https://mailtrap.io/api-smtp/integrations) from the sidebar.
* Locate the **Vercel** card under the **AI & Development** section.
* Click the **Integrate** button.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FhlvHtPQkqMk70wTXIbva%2Fvercel%201.png?alt=media&amp;token=4f9ac4f7-1fda-457b-8938-874bb871d59b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Authorize with Vercel account

Click the **Authorize with Vercel** account button. You will be redirected to the Mailtrap listing page.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FZlDLXoaqCo0RAPDYfjjv%2Fvercel%202.png?alt=media&amp;token=8224dd68-6261-409f-a7e7-3ce6c5367550" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Connect your Mailtrap account

On the Vercel integration page, click on **Connect Account** and then:

* Select your Vercel team.
* Select the specific project you want the integration to apply to.
  * **Note**: You’ll need to choose the project again on the Mailtrap side in the next step.
* Click **Connect Account** to proceed, and a new popup will appear.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FJthlJgavjqgy4v4yB58J%2Fvercel%204.png?alt=media&amp;token=bed41d69-da6d-47c0-a60b-69ec97cc247c" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Currently, the integration cannot be added to all projects, only to specific ones.
{% endhint %}
{% endstep %}

{% step %}

#### Select a Vercel project in Mailtrap

Select the specific Vercel project you want to configure from the dropdown menu.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FPM3eIM8Fi8pjWpVh0Khq%2Fvercel%205.png?alt=media&amp;token=efe73142-54a7-4c79-8168-0422cd61fd84" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Create an API Token

Choose the domain from which you intend to send emails and click **Create Token**. The token will be generated at the domain level.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FzukqKxnVpT7sBl7hJ8IM%2Fvercel%206.png?alt=media&amp;token=b1688902-8de0-4e47-9713-89c0655497c0" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Add environment variables and complete the installation

The following variables will be added to your Vercel project:

* `MAILTRAP_API_KEY` – Required for both testing and sending.
* `MAILTRAP_USE_SANDBOX` – Set to **True** to use Mailtrap's Sandbox for testing, or **False** for production sending.
* `MAILTRAP_INBOX_ID` – Required if using the Sandbox. Select the desired Inbox from the dropdown.

Once you’re done reviewing the variables, click **Set Environment Variables**. This will finalize the integration and close the setup window.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FRZdyqkRZOdiOHs4K4iVa%2Fvercel%207.png?alt=media&amp;token=44e03138-c66e-4719-b4ee-221ddc0071fa" alt=""><figcaption></figcaption></figure>

#### Verifying the integration in Vercel

Once the setup is complete, you can verify the environment variables in your Vercel account:

1. Go to your Vercel project settings.
2. Navigate to the **Environment Variables** section.
3. You should see nine Mailtrap environment variables. A set of three variables (`API_KEY`, `USE_SANDBOX`, and `INBOX_ID`) for each of the three Vercel environments: **Development**, **Preview**, and **Production**.

<figure><img src="https://365478608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgkNigAKiqQtQub1GOdjY%2Fuploads%2FnHtxYFn0yAs9hcLAQk9K%2Fvercel%208.png?alt=media&amp;token=6e11354f-6ec6-4312-89c0-0bd30dcd9e95" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


---

# 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.mailtrap.io/guides/integrations/vercel.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.
