连接器指南阅读约 7 分钟53 个 MCP 工具7 种语言

Mailtrap 接入 MCP:在任意 AI 智能体中发送邮件、用 Email Sandbox 测试、查看邮件日志、管理模板和营销活动

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

HC作者:HelpCode 团队更新于 7 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

Mailtrap

Mailtrap

Mailtrap email platform: send transactional, bulk and batch emails, test them in Email Sandbox (messages, spam and HTML reports), manage sending domains, suppressions, templates, Email Marketing contacts, lists and campaigns, and read sending stats and email logs.

个工具

53

区域

INTL

类别

电子邮件

身份验证

Bearer Token

所需环境变量

MAILTRAP_API_TOKEN
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

跳过安装。2 分钟内即可运行。

在 cloud.anythingmcp.com 开始免费试用,一键添加 Mailtrap,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。

开始免费试用

摘要

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

试试这样问

Mailtrap 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

Mailtrap · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Mailtrap、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

Mailtrap

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

设置

设置大约需要 3 分钟。你需要一个 Mailtrap 账户。

  1. 在 Mailtrap 中打开 Settings、API Tokens(https://mailtrap.io/api-tokens)并创建一个令牌。为它授予发信域名(用于发送、统计、日志和抑制列表)、沙箱或项目(用于 Email Sandbox)以及(如果使用)Email Marketing 的访问权限。修改抑制列表需要管理员权限。
  2. 把它粘贴到 MAILTRAP_API_TOKEN。它以 Authorization: Bearer <token> 发送,在你重置之前不会过期。
  3. 安装连接器并运行 mailtrap_list_accounts:它会显示账户和你的访问级别(1000 owner、100 admin、10 viewer),并确认令牌有效。一个令牌只属于一个账户,所有调用都作用于该账户,因此不需要账户 ID。
  4. 真实发送需要已验证的发信域名(mailtrap_list_sending_domains);Email Sandbox 不需要域名也能使用。

Mailtrap 的各个功能使用不同的主机,连接器会为每个工具选择正确的主机:https://mailtrap.io 用于管理和报告,https://send.api.mailtrap.io 用于事务性发送,https://bulk.api.mailtrap.io 用于 Bulk 流,https://sandbox.api.mailtrap.io 用于向沙箱发送测试邮件。

发送:mailtrap_send_email 发送一封事务性邮件,最多 1000 个收件人;mailtrap_send_batch_emails 一次调用最多发送 500 封不同的邮件(最大 50 MB)。营销邮件和其他群发邮件通过 Bulk 流发送,使用 mailtrap_send_bulk_email 和 mailtrap_send_bulk_batch_emails,把推广流量与事务性邮件分开。内容可以是 text、html 或两者,也可以是已保存的模板:传入 template_uuid(mailtrap_list_templates 中的 uuid,不是数字 ID)和 template_variables,并省略 subject、text、html 和 category。from_email 必须属于已验证的发信域名;to、cc 和 bcc 是 {"email", "name"} 列表;附件以 Base64 放在 content 中。每次发送都会进入真实收件箱,所以 AI 会先向你展示收件人、发件人、主题和内容,等你确认。发送会返回 message_ids,每个收件人一个。批量调用即使有单封邮件失败也返回 200:AI 会检查 responses 中每一项的 success 和 errors。

Email Sandbox:mailtrap_send_sandbox_email 发送的测试邮件会被沙箱拦截,永远不会投递,是试用模板或新内容的安全方式。随后 AI 会读取被拦截的邮件(mailtrap_list_sandbox_messages、mailtrap_get_sandbox_message),以纯文本、预览 HTML、HTML 源码或原始 MIME 形式查看正文,查看邮件头、附件、带分数和命中规则的 SpamAssassin 报告,以及显示哪些邮件客户端不支持哪些元素和 CSS 属性的 HTML 检查。它还能列出项目和沙箱并创建沙箱;任何返回中都不包含 SMTP 凭据。

域名和送达率:列出和读取发信域名,包括需要发布的 DNS 记录(SPF、DKIM、DMARC、return path)及其验证状态,添加域名,并把 DNS 设置说明通过邮件发给负责 DNS 的人。被抑制的地址(硬退信、退订、垃圾邮件投诉、手动导入)会连同导致抑制的邮件一起列出;mailtrap_create_suppression 可停止向某个地址发送。查看单封邮件时,mailtrap_list_email_logs 可按收件人、状态、事件、分类和发送时间筛选,mailtrap_get_email_log 显示其投递、打开、点击和退信事件以及服务商的响应。mailtrap_get_sending_stats 给出一段时间的汇总,mailtrap_get_sending_stats_grouped 按域名、分类、邮箱服务商或天拆分,mailtrap_get_billing_usage 显示相对于套餐的用量。

模板:列出、读取、创建和更新模板。变量使用 Handlebars,例如 {{user_name}};更新后发送的邮件使用新版本。

Email Marketing:带状态、列表和字段的联系人(按 ID 或邮箱创建、读取和更新;为自动化和细分记录 purchase 等自定义事件;按邮箱匹配导入最多 50,000 个联系人,并用 mailtrap_get_contact_import 跟踪),联系人列表和联系人字段(作为 fields 键使用的合并标签)。营销活动:mailtrap_create_campaign 总是创建草稿,mailtrap_update_campaign 修改草稿,mailtrap_schedule_campaign 设置最多一个月后的发送时间,mailtrap_start_campaign 立即发送,mailtrap_cancel_campaign 把已排程的活动退回草稿,mailtrap_get_campaign_stats 显示结果。排程和启动会向全部受众发邮件:AI 会先和你确认活动、受众和时间。只添加同意接收邮件的联系人;不想再给某人发邮件时,把他退订(unsubscribed: true),而不是删除。

安装时关闭:mailtrap_delete_suppression(该地址将重新收到邮件)、mailtrap_clean_sandbox(删除沙箱中的所有邮件)和 mailtrap_delete_contact。它们无法撤销,因此团队需要时由工作区管理员开启。

数据格式:域名、沙箱、邮件、模板、列表和营销活动的 ID 是整数;联系人、抑制记录和邮件日志中的邮件使用 UUID。时间为 UTC 的 ISO 8601 格式。统计中的比率是小数(0.25 = 25%),统计日期为 YYYY-MM-DD。

分页:联系人把 pagination.next_token 作为 token 传入,直到它为 null;营销活动把 pagination.next_token 中的页码作为 token。邮件日志把 next_page_cursor 作为 search_after 传入。抑制记录每页 1000 条,把最后一条的 id 作为 last_id。沙箱邮件每页 30 条,使用 page 或把最后一封邮件的 ID 作为 last_id。

限制:每个令牌每 10 秒 150 次请求;联系人每分钟 200 次,统计和抑制列表每分钟 10 次,列出邮件日志每个账户每分钟 60 次。

常见错误:401 Incorrect API token 表示令牌错误,或没有该域名或沙箱的访问权限。403 表示缺少权限:在 Settings、API Tokens 中编辑令牌。404 表示未知 ID。422 表示输入无效,原因在 errors 中,例如发件人不在已验证域名上,或营销活动已不是草稿。429 表示触发速率限制:稍等后重试。

该连接器不删除发信域名、沙箱、模板或营销活动,也不返回沙箱的 SMTP 凭据。

前提条件: MAILTRAP_API_TOKEN

本地安装连接器

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

打开 http://localhost:3000/connectors/store,选择 Mailtrap 并填入前提条件中列出的环境变量。

可用工具

ToolWhat it does
mailtrap_list_accountsMailtrap accounts the API token can reach, with id, name and access_levels (1000 owner, 100 admin, 10 viewer)
mailtrap_get_billing_usageUsage of the current billing cycle: plan names and sent or stored message counts against their limits for Email Sending, Email Sandbox and…
mailtrap_send_emailSend one transactional email through the Email API (send.api.mailtrap.io): to up to 1000 recipients, with text and/or HTML, or from a…
mailtrap_send_batch_emailsSend up to 500 different transactional emails in one call (send.api.mailtrap.io/api/batch): shared fields in base, one entry per message in…
mailtrap_send_bulk_emailSend one marketing or bulk email through the Bulk stream (bulk.api.mailtrap.io), which keeps promotional traffic apart from transactional…
mailtrap_send_bulk_batch_emailsSend up to 500 different bulk (marketing) emails in one call through the Bulk stream (bulk.api.mailtrap.io/api/batch)
mailtrap_list_sending_domainsSending domains of the account with their id, DNS verification and compliance status and tracking settings
mailtrap_get_sending_domainOne sending domain with the DNS records to publish (SPF, DKIM, DMARC, return path) and whether each is verified, plus compliance status and…
mailtrap_create_sending_domainAdd a sending domain
mailtrap_send_domain_setup_instructionsEmail the DNS setup instructions of a sending domain to someone, e.g. the person who manages DNS
mailtrap_list_suppressionsAddresses Mailtrap no longer sends to (hard bounce, unsubscription, spam complaint, manual import), up to 1000 per call, with the message…
mailtrap_create_suppressionStop sending to an address on one domain and stream
mailtrap_delete_suppressionRemove a suppression so the address receives email again
mailtrap_get_sending_statsSending totals for a date range: delivery, bounce, open, click and spam counts and rates, optionally limited to domains, streams…
mailtrap_get_sending_stats_groupedThe same sending stats split by sending domain, category, recipient mailbox provider or day
mailtrap_list_email_logsSent messages of the account, newest first, with status, recipient, subject, category, opens and clicks
mailtrap_get_email_logOne sent message with its delivery events (delivery, open, click, bounce with the provider response), custom variables, template and a link…
mailtrap_list_sandbox_projectsEmail Sandbox projects with the sandboxes (test inboxes) in each
mailtrap_list_sandboxesAll sandboxes (test inboxes) with id, name, project, message and unread counts and the sandbox email address
mailtrap_get_sandboxOne sandbox: name, project, message counts, size limits, SMTP host and ports and its email address
mailtrap_list_sandbox_messagesMessages caught in a sandbox, newest first, 30 per page: id, subject, sender, recipient, sent time, size and read state (SMTP details and…
mailtrap_get_sandbox_messageOne sandbox message: sender, recipient, subject, size, SMTP details and blacklist report summary
mailtrap_get_sandbox_message_bodyThe body of a sandbox message: txt (plain text), html (sanitized for preview), htmlsource (the HTML as sent) or raw (the whole MIME message)
mailtrap_get_sandbox_message_headersThe mail headers of a sandbox message (From, To, Subject, Message-ID, List-Unsubscribe, ...)
mailtrap_get_sandbox_spam_reportSpamAssassin report of a sandbox message: total score, threshold and the rules that matched
mailtrap_get_sandbox_html_analysisHTML check of a sandbox message: which elements and CSS properties are unsupported by which email clients, with an overall support score
mailtrap_list_sandbox_attachmentsAttachments of a sandbox message with filename, content type, size and download path
mailtrap_send_sandbox_emailSend a test email into a sandbox (sandbox.api.mailtrap.io): it is caught there and never reaches the recipients, so it is safe for trying…
mailtrap_create_sandboxCreate a sandbox (test inbox) in a project; the answer carries its id and email address, SMTP credentials left out
mailtrap_clean_sandboxDelete every message in a sandbox
mailtrap_list_contactsEmail Marketing contacts, 25 per page by default (at most 50), with id, email, status, list ids and fields
mailtrap_get_contactOne contact by id or email: status, lists, fields and timestamps
mailtrap_create_contactAdd a contact, optionally with fields (by merge tag) and lists
mailtrap_update_contactChange a contact: email, fields, list membership or subscription status
mailtrap_delete_contactDelete a contact for good, e.g. on an erasure request
mailtrap_create_contact_eventRecord a custom event for a contact (e.g. purchase, trial_started) with parameters, for automations and segments
mailtrap_list_contact_listsContact lists with id and name; search filters by the start of the name
mailtrap_create_contact_listCreate an Email Marketing contact list; add contacts with list_ids or list_ids_included afterwards
mailtrap_list_contact_fieldsContact fields with id, name, data type and the merge tag used in contact fields and templates
mailtrap_import_contactsCreate or update up to 50,000 contacts in one asynchronous import, matched by email
mailtrap_get_contact_importStatus of a contact import (created, started, finished, failed) with the counts of created and updated contacts and those over the plan…
mailtrap_list_templatesEmail templates of the account with id, uuid (used to send), name, category and subject
mailtrap_get_templateOne email template with subject, HTML and text body (Handlebars variables such as {{user_name}})
mailtrap_create_templateCreate an email template
mailtrap_update_templateChange an email template; only the fields you pass change
mailtrap_list_campaignsEmail Marketing campaigns, newest first, with id, name, state and schedule
mailtrap_get_campaignOne campaign: state, sender, audience lists and segments, delivery mode, template and schedule
mailtrap_get_campaign_statsResults of a campaign: delivered, opened, clicked, bounced, spam and unsubscribed counts and rates, optionally for a date window
mailtrap_create_campaignCreate a campaign as a draft: sender, audience, subject and design
mailtrap_update_campaignChange a draft campaign; only the fields you pass change
mailtrap_schedule_campaignSchedule a draft campaign to go out at a set time, at most one month ahead
mailtrap_start_campaignStart sending a draft campaign now to its whole audience
mailtrap_cancel_campaignCancel a scheduled campaign before it goes out; it goes back to draft and can be edited again

示例提示

  • “今天早上发给 [email protected] 的订单确认邮件送达了吗?给我看它的事件。”
  • “把这个新的欢迎模板发到我们的测试沙箱,告诉我它的垃圾邮件分数,以及哪些邮件客户端对这段 HTML 有问题。”
  • “上周我们的送达率、退信率和垃圾邮件率是多少?按邮箱服务商拆分。”
  • “我们发信域名的哪些 DNS 记录还没有通过验证?”
  • “用 11 月新闻邮件模板为客户列表创建一个营销活动草稿,排程前先给我看受众。”

下一步

这份指南对你有帮助吗?

你的 Mailtrap 智能体只差一次点击。

安装连接器,粘贴密钥,向你的 AI 客户端提问。免费试用 7 天,无需信用卡。

相关指南

连接器

如何通过 MCP 将 Mailtrap 连接到 ChatGPT

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

连接器

如何通过 MCP 将 Mailtrap 连接到 Claude

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

连接器

如何通过 MCP 将 Mailtrap 连接到 Cursor

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

连接器

如何通过 MCP 将 Mailtrap 连接到 Gemini

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

连接器

如何通过 MCP 将 Mailtrap 连接到 Meta Muse

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。

连接器

如何通过 MCP 将 Mailtrap 连接到 Microsoft Copilot

在任意 AI 智能体中使用 Mailtrap 账户:发送事务性、批量和群发邮件,在 Email Sandbox 中测试并查看垃圾邮件和 HTML 报告,管理发信域名、抑制列表和模板,在邮件日志中跟踪每封已发送的邮件,查看发送统计,并管理 Email Marketing 的联系人、列表和营销活动。只需一个 API 令牌;不可撤销的删除操作在安装时关闭。