> 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/integrations/guides/vercel.md).

# Vercel

Comprehensive guide to integrate Mailtrap with Vercel for live email sending, sandbox testing, and inbound email.

You can integrate Mailtrap with Vercel in two ways, through:

* Environment variables added to your project
* Vercel Connect, which supplies Mailtrap credentials at runtime

Both let your Vercel apps send emails through Mailtrap, test them in Email Sandbox, receive inbound email, and use the Mailtrap API.

### Integration options

Mailtrap offers two main integration approaches with Vercel:

#### **Native Vercel integration (environment variables)**

Install the Mailtrap integration from Mailtrap’s Integrations page to automatically add Mailtrap credentials to your Vercel project as environment variables. This approach is ideal for apps that read their configuration from environment variables and switch between testing and production sending.

**Key features**:

* Mailtrap credentials are added to your project automatically, with no manual copying
* Separate variables for the Development, Preview, and Production environments
* Switch between Email Sandbox and live sending per environment
* An API token generated at the domain level during setup

See the native Vercel integration guide for detailed setup instructions.

{% content-ref url="/pages/DBszSrWlDUxzKXJ5KjmZ" %}
[Vercel Integration](https://docs.mailtrap.io/integrations/guides/vercel/integration.md)
{% endcontent-ref %}

#### **Vercel Connect (runtime credentials)**

Create a Mailtrap connector in Vercel, and your apps and AI agents request Mailtrap credentials at runtime instead of storing an API key in environment variables. This approach is ideal for AI-built apps and agents that should never see the API key.

**Key features**:

* The Mailtrap API key never appears in your app’s code or environment variables
* Credentials are requested at runtime through the Vercel Connect SDK
* One shared API key on the connector, which you can update or rotate in one place
* Works with the Email API, Email Sandbox, and the Inbound Email API

See the Vercel Connect guide for detailed setup instructions.

{% content-ref url="/pages/ok9y9JXVWbdGldFNwGdF" %}
[Vercel Connect](https://docs.mailtrap.io/integrations/guides/vercel/connect.md)
{% endcontent-ref %}

#### Which integration should you choose?

**Choose the native integration if you**:

* Want the quickest setup with no code changes to how your app reads credentials
* Already use environment variables for your app’s configuration
* Want separate testing and production settings for each Vercel environment
* Only need to send emails, in testing or production

**Choose Vercel Connect if you**:

* Don’t want the API key stored in environment variables
* Are building an AI agent that sends or reads emails without the model seeing the API key
* Built your app with v0 or the AI SDK
* Need the Inbound Email API, for example to give an agent its own email address
* Want to rotate the API key in one place without redeploying

#### Getting started

Both integration guides above contain step-by-step instructions, screenshots, and code examples. Choose the option that best fits your use case and follow the corresponding guide.


---

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