VS Code
With the VS Code Mailtrap integration, you can send emails directly from Visual Studio Code using simple AI prompts powered by GitHub Copilot.
Mailtrap is an email-sending solution for developer and product teams focused on fast delivery and high inboxing rates for transactional and promo emails. It provides a highly customizable API and 24/7 technical support.
In this guide, you'll set up the integration and send emails in three steps.
Prerequisites
Before you start, ensure the following:
Set up your sending domain — this takes approximately 5 minutes
Install the latest Node.js version since Mailtrap MCP is implemented as a Node.js command line utility
Install or update Visual Studio Code to the latest version
Add Mailtrap MCP to VS Code
To add Mailtrap MCP to VS Code, you can use the quick install link or follow these steps:
Open VS Code and navigate to Settings
Search for MCP in the settings search bar
Tick the Chat > MCP: Enabled option
Click Edit in settings.json

In your settings.json file, add the following code snippet:
{
"mcp": {
"servers": {
"mailtrap": {
"command": "npx",
"args": ["-y", "mcp-mailtrap"],
"env": {
"MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
"DEFAULT_FROM_EMAIL": "[email protected]"
}
}
}
}
}Make sure to restart your MCP server after changing the "env" section.
Add Mailtrap API credentials
Replace the following values in your settings.json file:
MAILTRAP_API_TOKEN — Authentication token for API requests. You can copy this from the Credentials tab in your Mailtrap account
DEFAULT_FROM_EMAIL — Must match your verified domain in Mailtrap's Sending Domains tab
Find these credentials in your Mailtrap account by navigating to Sending Domains → Integration → API.

Send emails with a prompt
To send an email:
Open the AI Pane in the upper-right corner of VS Code
Make sure Agent mode is selected (this allows VS Code to perform actions)

Open the list of available tools and select Mailtrap
If you see similar MCPs from other editors (like Cursor), uncheck them

Use this prompt (or create your own):
Send an email to [email protected] with the subject 'Hi John!' and a message that wishes John a great day.VS Code will identify the correct MCP server and suggest running the send-email tool. Click Continue to proceed.

The email will be sent successfully, and Copilot will confirm the action:

Verify the email in your Mailtrap dashboard by checking the Email Logs tab:

Last updated
Was this helpful?

