Need help with our last invoice
Hi team!
We were charged twice on invoice #4821 last week. Could you take a look and refund the duplicate? Screenshot attached.
Best regards,
Sarah
Give your AI agent a complete email layer. Send emails, receive replies, test output safely, and manage email workflows through a single API and MCP server.
// Claude or Cursor
{
"mcpServers": {
"mailtrap": {
"command": "npx",
"args": ["-y", "mcp-mailtrap"],
"env": {
"MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
"DEFAULT_FROM_EMAIL": "your_sender@example.com",
"MAILTRAP_ACCOUNT_ID": "your_account_id",
"MAILTRAP_SANDBOX_ID": "your_sandbox_id"
}
}
}
}
// VS Code
{
"mcp": {
"servers": {
"mailtrap": {
"command": "npx",
"args": ["-y", "mcp-mailtrap"],
"env": {
"MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
"DEFAULT_FROM_EMAIL": "your_sender@example.com",
"MAILTRAP_ACCOUNT_ID": "your_account_id",
"MAILTRAP_SANDBOX_ID": "your_sandbox_id"
}
}
}
}
}
// Claude Code (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": "22.14.0",
"MAILTRAP_API_TOKEN": "your_mailtrap_api_token",
"DEFAULT_FROM_EMAIL": "your_sender@example.com",
"MAILTRAP_ACCOUNT_ID": "your_account_id",
"MAILTRAP_SANDBOX_ID": "your_sandbox_id"
}
}
}
}
// MCP Bundle (MCPB)
Download the .mcpb file from GitHub Releases and open it in Claude Desktop.
Skip the custom MIME parsing, header extraction, and attachment handling. Mailtrap converts every incoming message into a predictable JSON payload your backend can consume immediately – sender, recipients, subject, headers, plain text, HTML body, and attachment download URLs, all in one structured object.
Hi team!
We were charged twice on invoice #4821 last week. Could you take a look and refund the duplicate? Screenshot attached.
Best regards,
Sarah
{"id": "1700000000000123","inbox_id": 12345,"from": "sarah@acme.co","to": ["support-bot-1a2b3c4d@inbound-mailtrap.io"],"cc": ["trev@acme.co","sophie@acme.co","brian@acme.co"],"bcc": [],"reply_to": null,"subject": "Need help with our last invoice","rfc_message_id": "<abc@acme.co>","in_reply_to": null,"references": [],"headers": {"mime-version": "1.0","return-path": "<sarah@acme.co>"},"size": 258048,"html_size": 198,"text_size": 150,"received_at": "2026-05-27T10:42:11.000Z","thread_id": "1700000000000124","attachments": [{"attachment_id": "att-1","size": 188416,"filename": "invoice-4873.png","content_type": "image/png","content_disposition": "attachment","content_id": null,"download_url": "https://s3.amazonaws.com/inbound-mail/att-1?X-Amz-Signature=...","download_url_expires_at": "2026-05-27T11:42:11.000Z"}],"raw_message_url": "https://s3.amazonaws.com/inbound-mail/raw.eml?X-Amz-Signature=...","raw_message_expires_at": "2026-05-27T11:42:11.000Z","html_body": "<html><body><p>Hi team!</p><p>We were charged twice on invoice #4873 last week. Could you take a look and refund the duplicate? Screenshot attached.</p><p>Best regards,</p><p>Sarah</p></body></html>","text_body": "Hi team!\n\nWe were charged twice on invoice #4873 last week. Could you take a look and refund the duplicate? Screenshot attached.\n\nBest regards,\n\nSarah"}
Test outbound email, receive inbound messages, trigger workflows, and send replies – all via Mailtrap API.
curl -X POST https://send.api.mailtrap.io/api/send \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "from": { "email": "agent@yourdomain.com" }, "to": [{ "email": "recipient@example.com" }], "subject": "Your receipt", "text": "Thanks for your order." }'
Send transactional and bulk email through the REST API or SMTP. Keep the two on separate sending streams, use templates, and rely on official SDKs in your agent’s language.
Spin up an inbox per agent with no DNS setup. Every incoming message arrives as parsed JSON via webhook and the Messages API, with attachments as download links.
Answer inbound email with a single API call. Mailtrap sets the threading headers and sender address, and your agent can fetch the full conversation as context.
Point your agent at Email Sandbox during development. It captures every email instead of delivering it, so you can check content, headers, attachments, spam score and HTML first.
Connect Claude, Cursor, VS Code and other MCP clients. Over 130 tools cover sending, inbound inboxes and messages, Sandbox and templates, all through natural-language requests.
Official SDKs for Node.js, PHP, Python, Ruby, Java and .NET. The CLI runs sending, Sandbox and account tasks from the terminal, with JSON output for scripts and agents.
Whether you're building a coding agent, an AI app or an assistant, Mailtrap gives it one email layer, through the API and the MCP server.
Easily connect Mailtrap to the tools you use and keep everything running smoothly.
Call the Mailtrap API to create an inbox, then register a webhook URL where your agent gets notified when new mail arrives. Start on a Mailtrap-hosted address with no MX records, no DNS, and no mail server to set up, or connect your own custom domain when you’re ready for production. The moment an email lands, your agent gets a webhook notification and can fetch the fully parsed message from the Messages API. Create or delete inboxes programmatically for each agent, project, or session.
OAuth into a personal Gmail account hands your agent someone’s entire mailbox, with all the privacy, scope, and security questions that it brings, and it breaks the moment a token is revoked. A dedicated agent inbox is isolated, scoped to addresses you control, and provisioned per agent or project. Your agent only ever sees emails meant for it, and you can spin inboxes up or tear them down without touching anyone’s personal account.
No, not to get started. A Mailtrap-hosted inbox works the moment you create it, with nothing to add in DNS and no MX records to configure. When you’re ready for production, connect your own custom domain and keep the same API and webhooks. Replies go out the same way in both cases, with a single API call.
Yes. Replying is part of the same API, so your agent answers in-thread with a single API call and the conversation flows both ways. On a Mailtrap-hosted inbox, replies are capped at 20 in total; connect your own custom domain and that limit goes away.
It’s a safe, Mailtrap-hosted environment that captures the email your AI agent sends instead of delivering it. Your agent sends exactly as it would in production but every message lands in the sandbox, where you can read the content, headers, and attachments, check the spam score, and validate the HTML. Nothing reaches a real recipient, so you can test what an agent generates without any risk of emailing a customer by mistake.
A common approach is to have your AI agent generate emails in Mailtrap Sandbox first instead of sending them directly.
You can review the message in the Mailtrap UI or retrieve its content, spam score, HTML checks, and other analysis via API. If changes are needed, your AI agent can revise the draft and send an updated version to Sandbox for another review cycle.
Once the email looks right, switch to Mailtrap’s sending endpoint (or the Inbound Reply API for inbound conversations) to deliver the final message. This creates a simple human approval workflow without changing your email generation logic.