Skip to content
All articles

AI agents · 19 November 2026 · 9 min read

How to let an AI agent send email with MCP

Rampsend team

Let your agent send

AI assistants are good at writing email. Until recently they could not send it: you copied the draft, pasted it into another tool and pressed send yourself. The Model Context Protocol changes that. Connect an email platform as an MCP server and the assistant can send a message, check whether it was delivered, look at your bounce rate and tell you which DNS record your domain is still missing. This guide explains how that connection works, which credential to choose, and the safeguards worth keeping on.

What MCP actually is

The Model Context Protocol is an open standard for connecting AI applications to outside tools and data. An MCP server publishes a list of tools, each with a name, a description and a schema for its inputs. The assistant (the MCP client) reads that list, decides when a tool would help, and calls it with structured arguments. The server runs the action and returns a result the model can read.

For email, that means the assistant does not need to know anything about SMTP, DKIM or your provider's API. It sees a tool called send_email with fields for from, to, subject and html, and it fills them in from your conversation. Everything difficult — authentication, signing, suppression, tracking — happens on the server, exactly as it would for a normal API call.

Remote MCP servers usually speak Streamable HTTP: one HTTPS endpoint that the client posts JSON-RPC messages to. That is what makes setup so short. There is no local process to install; the client only needs a URL and a credential.

Two ways to connect: sign-in or API key

Every MCP connection needs to prove who you are and which account the agent may act on. There are two common ways.

OAuth sign-in

With OAuth, you paste the endpoint into your assistant, it opens the provider's sign-in page in your browser, and you approve access. Rampsend's MCP server uses OAuth 2.1 with dynamic client registration, so there is no client ID or secret to fill in. You approve one workspace, and the connection is limited to it. Connected assistants appear under Integrations → AI assistants in the app, where you can revoke any of them.

Sign-in is the right choice for chat assistants. In Claude and ChatGPT it is effectively the only choice, because their connector dialogs take a URL rather than a key. The Claude setup guide walks through it step by step.

API key in a header

Coding agents and editors — Cursor, VS Code, Claude Code, Codex, the Gemini CLI — can send an API key in the Authorization header instead. This works on headless machines, in CI and anywhere a browser sign-in is awkward. Keep the key in an environment variable and reference it from the config file, so the key itself never lands in a repository. The Cursor guide shows the exact spelling, which differs from editor to editor.

OAuth sign-inAPI key
Best forClaude, ChatGPT, chat on any deviceCoding agents, scripts, headless machines
SetupPaste a URL, sign in, approve a workspaceCreate a key, reference it from config
RevokingIntegrations → AI assistantsRevoke the key under Developers → API keys
Adding new domainsNo (check only)Yes, with a Full access key

The tools an email agent gets

What the agent can do depends entirely on which tools the server exposes. Rampsend's MCP server currently offers twelve:

  • Account and sending: get_account (credit balance, sending status, today's sends, your domains) and send_email (up to 50 recipients per call, one credit each).
  • Delivery and engagement: get_email for one message, list_emails for recent messages filtered by status or recipient, and get_stats for sent, delivered, bounces, complaints, opens, clicks and unsubscribes over the last N days, with machine opens counted apart.
  • Domains: add_domain to start verifying a domain and get its DNS records, and check_domain to re-check DNS and see what is still missing.
  • Contacts and audiences: upsert_contact, find_contacts, track_event, list_audiences and add_to_list.

The full table, with the endpoint and config snippets, is in the MCP section of the developer docs.

Two details are worth knowing. First, send_email behaves like the REST send endpoint: each recipient gets their own copy with its own id and status, and recipients on your suppression list come back as suppressed and are not charged. Second, read-only tools such as get_account cost nothing, which makes "How many credits do I have left?" a safe first test of a new connection.

Confirm before send

The biggest worry about letting an agent send email is that it will send something you did not mean to: the wrong recipient, a half-finished draft, a test that goes to a real list. There are three layers of protection, and you want all of them.

The tool asks for confirmation. Rampsend's send_email description tells the assistant to confirm with you before sending. In practice the model shows you the from address, recipients, subject and body and waits for a yes.

The client asks for approval. Most MCP clients put their own approval step in front of tools that change something. ChatGPT asks before write actions by default. The Gemini CLI asks unless you set trust to true for the server. Claude and the coding agents show a permission prompt before a tool runs. Leave these on.

The server enforces the rules that matter. A model can be talked into things; a server cannot. Sending only works from a verified domain. Suppressed addresses are skipped no matter what the agent asks. If bounce or complaint rates spike, sending pauses for the whole workspace and the API returns sending_paused until you have looked at it.

Setting up a sending domain through the agent

Before any email goes out, the sending domain has to be verified: DKIM so receivers can check the signature, a custom MAIL FROM subdomain so SPF aligns with your From address, and a DMARC record. The SPF, DKIM and DMARC guide explains each one.

An agent is useful here because DNS is fiddly and the feedback loop is slow. With a Full access API key, the agent can call add_domain, give you the exact records to paste into your DNS provider, and then call check_domain until everything passes. With OAuth sign-in, you add the domain in the app under Deliverability → Domains, and the agent can still run check_domain and tell you, in plain language, which record is missing or wrong.

A worked example

Here is what a short session looks like in Claude with Rampsend connected by sign-in.

You: Is acme.eu ready to send from?

Claude: I checked acme.eu. DKIM and the MAIL FROM records are verified. The DMARC record is missing — add a TXT record at _dmarc.acme.eu with the value shown in your Rampsend dashboard. Gmail and Yahoo expect DMARC from bulk senders.

You: Added it. Check again, then send our welcome email to ada@example.com as a test.

Claude: acme.eu now passes all checks. Here is the email I am about to send: From: Acme <hello@acme.eu> · To: ada@example.com · Subject: Welcome to Acme · Body: (the draft from earlier). Click tracking will be on. Shall I send it?

You: Turn click tracking off and send.

Claude: Sent. Status: sent, id 6f1c… I will check delivery in a moment.

You: Did it arrive?

Claude: Yes — delivered two seconds after sending. No opens yet.

Nothing in that exchange needed a dashboard, but every step was visible to you, and the send waited for an explicit yes.

When an agent should not send

MCP makes sending easy, which is exactly why a few things should stay out of the agent's hands:

  • Large marketing sends from a chat. Fifty recipients per call is plenty for tests, alerts and small batches. Newsletters to thousands of people belong in a proper workflow with consent checks, an unsubscribe header and a warmed-up domain (see warming up a new sending domain).
  • Anything with retries you cannot see. If an agent or script might resend after a timeout, use the REST API with an Idempotency-Key so the second attempt returns the first result instead of sending twice. The idempotency guide covers the pattern.
  • Sending to lists of unknown origin. An agent will happily email a pasted spreadsheet. Bounces and complaints from that list land on your domain. Keep bounce and complaint rates in mind before you hand over a list.

A safety checklist for email agents

Run through this once when you connect an assistant, and again when you widen what it is allowed to do.

  1. Use the narrowest credential. Sign-in for chat. A Sending only key for agents that only send and read stats. Full access only when the agent must add domains or manage contacts.
  2. Keep keys out of files. Reference RAMPSEND_API_KEY (or similar) from config, never paste the literal key into a committed mcp.json.
  3. One workspace per purpose. A connection is limited to the workspace you approve. Keep experiments in a separate workspace from production sending.
  4. Leave confirmation prompts on. Both the tool's confirm step and the client's approval step.
  5. Verify the domain first. DKIM, MAIL FROM and DMARC, checked by check_domain, before the first real send.
  6. Turn tracking off for sensitive mail. Password resets and sign-in links should go out with track_clicks set to false so links are not rewritten.
  7. Add the unsubscribe header to anything that is not strictly transactional. It is one flag, unsubscribe_header, and Gmail and Yahoo require one-click unsubscribe for bulk mail (see the sender requirements checklist).
  8. Review what the agent sent. Ask it for list_emails or get_stats now and then, or open the deliverability dashboard.
  9. Revoke what you no longer use. Old connections and keys are risk with no benefit.

Getting started

If you want to try this, the shortest path is the MCP setup guides: pick your assistant, paste the endpoint, sign in, and ask how many credits you have left. The Free plan covers 1,000 contacts and 6,000 emails a month, which is plenty to test an agent end to end; details are on the pricing page. If you would rather wire it into your own code, the quickstart gets you from API key to first send in a few minutes.

Frequently asked questions

Can an AI agent send email on its own without asking me?

It can if you let it. Rampsend's send_email tool tells the assistant to confirm with you first, and most clients also ask for approval before any action that changes something. Keep those prompts on unless you are running a tested, automated workflow.

Should I connect with OAuth sign-in or an API key?

Use sign-in for chat assistants such as Claude and ChatGPT: there is nothing to paste and you can revoke it from the app. Use an API key for coding agents and scripts, stored in an environment variable rather than a config file.

Can the agent set up my sending domain?

Partly. Any connection can run check_domain and tell you which DNS records are still missing. Adding a new domain with add_domain needs a Full access API key, so with sign-in you add the domain in the app and let the assistant check it.

Does sending through an agent cost more than the API?

No. An email sent through the MCP server is the same as one sent through the REST API: one credit per recipient, and suppressed recipients are skipped and not charged. See pricing.

Which assistants work with Rampsend's MCP server?

Claude, ChatGPT, Cursor, VS Code, Claude Code, Codex and the Gemini CLI, plus any client that speaks Streamable HTTP MCP. Step-by-step guides are at /mcp.