Send emails with Windsurf and Mailtrap

With the Windsurf Mailtrap integration, you can now send emails from Windsurf with simple prompts.

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.

In this article, you’ll learn how to set it all up and start sending emails in three steps.

Prerequisites: 

  • If you haven’t set up your sending domain already, you’ll need to do it before we start—it takes ~5 minutes, and you can use our step-by-step article as a guide.
  • Install the latest Node.js version since Mailtrap MCP is implemented as a Node.js command line utility.
  • If you haven’t already done so, install Windsurf. But if you have, make sure it’s updated and uses the latest version.

Step 1. Add Mailtrap MCP to Windsurf

Open Windsurf, then navigate to Settings → Windsurf Settings. 

On the Windsurf Settings page, you will see the Manage MCPs button. Click on it, and you’ll be taken to the mcp.config.json file.

Then, in the mcp.config.json file, copy/paste the following code snippet:

{
  "mcpServers": {
    "mailtrap": {
      "command": "npx",
      "args": ["-y", "mcp-mailtrap"],
      "env": {
        "MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
        "DEFAULT_FROM_EMAIL": "your_sender@example.com"
      }
    }
  }
}

Step 2. Add Mailtrap API credentials

All there’s left to do is replace the following values in the mcp.config.json file:

  • 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.

You can find these credentials in your Mailtrap account by navigating to Sending Domains → Integration → API

Note: Although you shouldn’t face any issues, I still recommend reloading Windsurf to make sure everything is being set up correctly.

Step 3. Send emails with a prompt

To send an email, open the Cascade side-bard in the upper-right corner in Winsurf. Then, make sure that the Mailtrap MCP server is enabled under Customizations, which will allow it to perform actions for us.

Then, to send a plain-text email, use the prompt below, but feel free to come up with your own prompts and experiment since the possibilities are plenty.

Send an email to john.doe@example.com with the subject ‘Hi John!’ and a message that wishes John a great day.

If you followed everything correctly so far, you should see the following message:

And here is the email in our inbox:

It’s also waiting for us in the Email Logs tab in the Mailtrap dashboard.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us