Trusted by teams building with AI

Atlassian is a customer of Mailtrap
Adobe is a customer of Mailtrap
Yelp is a customer of Mailtrap
PayPal is a customer of Mailtrap
Toptal is a customer of Mailtrap
Calendly is a customer of Mailtrap

Every endpoint your agent needs for email workflows

Clean REST endpoints with typed SDKs, so your agent can create inboxes, receive, parse, and reply to incoming messages in a few lines of code.

  • GET /inbound/folders

    Group inboxes by agent, project, or workflow

  • GET /inbound/folders/{id}/inboxes

    Create hosted or custom-domain inboxes for each agent or task

  • GET /inbound/inboxes/{id}/messages

    List, search, and fetch parsed messages – sender, body, headers, attachments as URLs

  • Mailtrap /templates endpoint

    GET /api/webhooks

    Reply in-thread; Mailtrap handles headers and sender address

View All Endpoints

Copy

curl -X GET https://mailtrap.io/api/inbound/folders \
  -H 'Authorization: Bearer YOUR_API_KEY'
View All Endpoints

Give your agent access to Mailtrap over MCP

Add Mailtrap to Claude, Cursor, VS Code, and any MCP-compatible client. Your agent creates inboxes, reads inbound messages, replies in-thread, and manages webhooks through natural-language tool calls.

Copy

{
  "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_TEST_INBOX_ID": "your_test_inbox_id"
      }
    }
  }
}

Why put your AI agent's inbox on Mailtrap

Everything your agent needs to receive, process, and reply to email.

  • Start in minutes, move to production when ready

    Start in minutes, move to production when ready

    Create a hosted inbox instantly. When you’re ready, connect your own domain using the same API.

    • No DNS or MX setup to get started
    • Inbox ready immediately
    • Move to a custom domain for production
  • Email as an agent trigger

    Email as an agent trigger

    Turn incoming emails into events your agent can process instantly via webhook.

    • Convert emails into agent events
    • Trigger workflows and automations
    • Send replies and follow-ups automatically
  • Complete inbound email stack

    Complete inbound email stack

    Receive, parse, test, and reply to inbound email from one platform.

    • Structured incoming messages
    • Attachments, headers, and HTML included
    • Reply in-thread with one API call

What you get with an agent inbox

Programmable agent inboxes

Create and delete inboxes through the API for each agent, workflow, or environment – persistent or disposable, on a Mailtrap-hosted address or your own custom domain.

Real-time webhooks

Get notified the second an email lands. The webhook delivers event IDs and key metadata; your agent fetches the full parsed message from the Messages API. No polling, no Gmail OAuth, no mail server to operate.

Structured email parsing

Every message you fetch from the Messages API is structured JSON: sender, recipients, subject, headers, plain text, HTML, and metadata – with no parsing library to maintain.

Attachments as URLs

Files arrive as links on the parsed message, so your agent grabs only what it needs and keeps its context window lean.

Conversation threading

Mailtrap groups replies into a single conversation, so your agent fetches the full thread and the context that comes with it – not scattered one-off messages.

Sandbox testing

Test how your agent handles incoming mail before a single real message hits production – the way you already test outbound email.

Built for developers automating email workflows

Whether you're building AI agents, internal tools, or automation pipelines, Mailtrap helps you receive, process, and reply to email through a single API.

  • AI & Agent Builders

    AI & Agent Builders

    Create inboxes for agents, assistants, copilots, and autonomous workflows.

    • Give your agent its own dedicated email address
    • Drop inbound email into your agent in a few lines
    • Reply in-thread with one API call, or keep a human in the loop
  • Backend developers

    Backend developers

    Add inbound email to internal systems, databases, support tools, and workflows.

    • Add inbound email to your internal apps and automations
    • Save each parsed message to your database after fetching it from the Messages API
    • Use a hosted address to get started, then move to your own custom domain for production
  • Automation & ops builders

    Automation & ops builders

    Use email as an event source for automation pipelines, approvals, routing, and notifications.

    • Kick off pipelines and jobs as soon as an email arrives
    • Spin up and tear down disposable inboxes per workflow, all via API
    • Isolate dev, staging, and production on separate inboxes

Common use cases

What teams build with agent inboxes

AI Support Agent

AI Support Agent

Receive support emails, create tickets, draft replies.

Invoice Processing

Invoice Processing

Extract PDFs and trigger accounting workflows.

AI Receptionist

AI Receptionist

Read appointment requests and schedule meetings.

GitHub Automation

GitHub Automation

Convert alert emails into issues and tasks.

Human-in-the-loop Reviews

Human-in-the-loop Reviews

Route emails to agents first, escalate when needed.

Workflow Automation

Workflow Automation

Trigger n8n, Make, or custom automations from incoming email.

Question icon

Frequently Asked Questions

  • How do you give an AI agent its own programmable email inbox?

    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.

  • Why give an agent a dedicated inbox instead of access to Gmail?

    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.

  • Does Mailtrap thread inbound conversations for my agent?

    Yes. When someone replies, Mailtrap groups the related messages into one conversation, so your agent can pull the full conversation history instead of stitching messages together itself. That gives it the context of the whole back-and-forth, which helps with follow-ups, support exchanges, and keeping agent memory in step with the conversation.

  • Do I need a custom domain or DNS setup to receive email?

    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.

  • Can I test my agent’s inbound flow before going live?

    Yes. Point your agent’s outgoing replies at an Email Sandbox during development. Every reply your agent generates lands in Sandbox instead of a real recipient, so you can inspect the content, threading headers, and formatting before going live.

  • Can my agent reply to inbound emails?

    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.