Cursor

Mailtrap is an email-sending solution for developer and product teams. Focused on fast delivery and high inboxing rates for transactional and promo emails. Provides highly customizable API and 24/7 tech support.

Overview

With the Cursor and Mailtrap integration, you can now send emails from Cursor using Model Context Protocol. In this guide, you'll learn how to set it all up and start sending emails in three steps.

Prerequisites

1

Add Mailtrap MCP to Cursor

To add Mailtrap MCP to Cursor, you can use the quick install linkarrow-up-right or in your Cursor editor, navigate to Settings → Cursor Settings.

Cursor application menu showing Settings option and Profiles menu

Go to the MCP tab and click on Add new global MCP server.

Cursor Settings window displaying MCP Servers section with Add new global MCP server button

The Add new global MCP server should open a new mcp.json config file, where we'll store the Mailtrap MCP configuration.

Tip: You can also open the mcp.json file in the following locations:

  • MacOS: ~/.cursor/mcp.json

  • Windows: %USERPROFILE%.cursor\mcp.json

Once you open the mcp.json file, copy/paste the following configuration inside it:

mcp.json
{
  "mcpServers": {
    "mailtrap": {
      "command": "npx",
      "args": ["-y", "mcp-mailtrap"],
      "env": {
        "MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
        "DEFAULT_FROM_EMAIL": "[email protected]"
      }
    }
  }
}

Note: In case you're using asdf to manage Node.js, you must use an absolute path to the executable. Here's an example for Mac:

mcp.json with asdf
{
  "mcpServers": {
    "mailtrap": {
      "command": "/Users/<username>/.asdf/shims/npx",
      "args": ["-y", "mcp-mailtrap"],
      "env": {
        "PATH": "/Users/<username>/.asdf/shims:/usr/bin:/bin",
        "ASDF_DIR": "/opt/homebrew/opt/asdf/libexec",
        "ASDF_DATA_DIR": "/Users/<username>/.asdf",
        "ASDF_NODEJS_VERSION": "20.6.1",
        "MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
        "DEFAULT_FROM_EMAIL": "[email protected]"
      }
    }
  }
}
2

Add Mailtrap API credentials

Open your Mailtrap account and navigate to Sending Domains → Integration → API.

Once in the Integration/API page, update the following values in your mcp.json file with Mailtrap credentials:

  • MAILTRAP_API_TOKEN – Used to authenticate API requests, which you can copy/paste from the credentials tab.

  • DEFAULT_FROM_EMAIL – Make sure the email's domain matches your own domain from the Sending Domains tab in Mailtrap.

Mailtrap account Integration tab showing sending domain name and API token

For example, here's what your mcp.json file should ultimately look like:

And that's it! Hit save, reload, and you can start sending emails via Cursor with simple prompts.

3

Send emails with a prompt

First, toggle the AI Pane, located in the upper-right corner of the Cursor editor.

In the opened pane, make sure that the Agent mode is configured since it allows Cursor to perform actions for us.

To send a plain-text email, you can use a prompt like this one (although we encourage you to use your own prompts and experiment with them since the possibilities are endless):

Send an email to [email protected] with the subject 'Hi John!' and a message that wishes John a great day.

Cursor will then identify the Mailtrap MCP server for your request, suggest running the right tool, in this case, send_email, and generate the email with all the parameters and values for you. As soon as you're ready to send, click Run tool.

Lastly, Cursor AI will notify you when it successfully delivers the email.

And here is the generated message in the Mailtrap Email Logs.

Mailtrap Email Logs dashboard showing delivered email with Hi John subject and metadata

Next steps

You can now use Cursor to compose and send various types of emails by adjusting your prompts. Experiment with different email templates, formatting options, and automation scenarios to maximize your productivity.

Last updated

Was this helpful?