Connect Mailtrap to Claude Code

Send transactional email, catch test email in sandboxes, and read delivery logs, stats and suppressions. Add Toolspoke to Claude Code once and it can use 17 Mailtrap actions. Your Mailtrap credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install Mailtrap and connect it

    Add Mailtrap to a project in your Toolspoke workspace.

    API token. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

    API token
    Mailtrap → Settings → API Tokens → Add Token. Give it access to the sending domains you send from and the sandboxes you test with; a token only sees the domains, projects and sandboxes it was granted.
  3. Choose what Claude Code may do

    All 17 actions start on. Switch off any of the 5 actions that change something in Mailtrap, and Claude Code gets a refusal if it tries.

What you can ask Claude Code for

A few of the Mailtrap actions that only read, so they are safe to try first.

  • List every sandbox (test inbox) the token can reach, across projects, with its id and message counts
  • List the messages caught in one sandbox, newest first, with subject, sender, recipients and size
  • Read the SpamAssassin report for one caught message, the overall score and each rule that fired
  • List the sending domains with their DNS verification and compliance status

What Claude Code can do in Mailtrap

12 actions read, one writes and 4 delete or permanently change something.

Reads

  • List sandboxes

    List every sandbox (test inbox) the token can reach, across projects, with its id and message counts. The sandbox id is what every other sandbox operation takes.

  • List sandbox messages

    List the messages caught in one sandbox, newest first, with subject, sender, recipients and size.

  • Get sandbox message

    Read one caught message's details, headers summary, recipients, size, and links to its HTML, text and raw bodies.

  • Get sandbox spam report

    Read the SpamAssassin report for one caught message, the overall score and each rule that fired.

  • Get sandbox html analysis

    Read the HTML compatibility analysis for one caught message, which elements and CSS each email client does not support.

  • List sending domains

    List the sending domains with their DNS verification and compliance status. Takes no arguments and reads real account data, so it is what an install tests itself with, and an unverified domain is the usual answer to why a send was rejected.

  • Get sending domain

    Read one sending domain, including the DNS records Mailtrap expects and whether each one is verified.

  • List email logs

    List sent messages with their delivery status, newest first, the place to look when someone says an email never arrived. Paged by cursor.

  • Get email log

    Read one sent message's log entry and its event history, delivery, opens, clicks, bounces.

  • Get sending stats

    Aggregate sending stats for a date range, delivered, bounced, opened, clicked and spam counts and rates, the same numbers as the Stats dashboard.

  • List suppressions

    List suppressed addresses, hard bounces, spam complaints and unsubscribes Mailtrap will not send to.

  • List templates

    List the email templates on the account, with the uuid send_email takes as template_uuid.

Writes

  • Send sandbox email

    Send one email into a Mailtrap sandbox instead of to its recipients. A write rather than destructive: the message is caught in the sandbox and reaches nobody, which is the point, use it to check how an email renders, scores for spam and validates before send_email. Same body fields as send_email.

Deletes or permanently changes

  • Send email

    Send one email through Mailtrap's transactional stream. Destructive: it delivers to real inboxes, cannot be recalled, and counts against the plan's sending quota. from must be on a verified sending domain. Supply text, html, or both, or template_uuid with template_variables instead of a body. To try an email without sending it, use send_sandbox_email.

  • Delete sandbox message

    Delete one caught message from a sandbox. There is no undo.

  • Clean sandbox

    Delete every message in a sandbox at once. Destructive because it is irreversible and other people's test runs may share the sandbox.

  • Delete suppression

    Remove an address from the suppression list, so Mailtrap will send to it again. Destructive because it overrides a bounce, complaint or unsubscribe, sending to someone who opted out is the thing suppression exists to prevent.

Mailtrap in Claude Code: questions

Does Claude Code see my Mailtrap credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Can I stop Claude Code from changing things in Mailtrap?

Yes. Each of the 17 actions can be switched off for a project. Turn off the 5 that change something and Claude Code can only read.

Will 17 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Mailtrap action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan, and a Mailtrap call does not run in a sandbox, so it bills nothing.

Try Mailtrap in Claude Code

Free to start, and tool calls cost nothing on any plan.