AI agents
SMTPfast gives an agent a real inbox on your own domain. Mail to an address like [email protected] is grouped into threads, with SPF, DKIM, DMARC, spam and virus verdicts on every message. The agent reads a thread and replies in it, or saves a draft for a person to approve. It works through the hosted MCP server or the REST API, with a key scoped to what the agent may do.
Verify your domain for sending, then turn on receiving and publish one MX record. On Cloudflare the dashboard can add it for you. Receiving needs a paid plan.
One address per agent or per job: support@, billing@, agent@. Mail the address received in the last 30 days is filed into threads at once.
A webhook tells your code that mail arrived. The agent reads the thread, then replies in it or saves a draft for a person to approve.
Add the hosted server to Claude Code, Claude Desktop, Cursor or another MCP client, then ask in plain words. Each tool is marked read-only or not, so the client can ask before anything changes.
# Claude Code, with OAuth: sign in when it asks
claude mcp add --scope user --transport http smtpfast https://smtpfa.st/api/mcp
# Or with a key that can read inboxes and write drafts, but not send
claude mcp add --scope user --transport http smtpfast https://smtpfa.st/api/mcp \
--header "Authorization: Bearer sf_inbound_read_only_key"Read the unread threads in [email protected].
For each order question, save a draft reply. Do not send anything.| list_inboxes / manage_inbox | Find the inbox, or create one (owner or admin key) |
| list_inbox_threads | Conversations by folder, label or search |
| get_inbox_thread_emails | The messages with bodies and authentication verdicts |
| save_inbox_draft | A reply or new message for a person to review. Sends nothing |
| send_inbox_draft | Send a reviewed draft, with the revision the person saw |
| reply_to_inbox_email / forward_inbox_email | Send at once, threaded, from the inbox address |
| update_inbox_thread / inbox_labels | Read state, archive, spam and labels |
Create the inbox once. Then an inbox.email.received webhook starts the agent for each new message: read it, check the verdicts, and save a reply draft in the same thread.
curl -X POST https://smtpfa.st/api/v1/inboxes \
-H "Authorization: Bearer $SMTPFAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email_address": "[email protected]", "name": "Support agent", "from_name": "Acme Support"}'// app/api/webhooks/smtpfast/route.ts
import { parseWebhook } from "@smtpfast/sdk";
const API = "https://smtpfa.st/api/v1";
const headers = { Authorization: `Bearer ${process.env.SMTPFAST_API_KEY}`, "Content-Type": "application/json" };
export async function POST(request: Request) {
const event = await parseWebhook({
payload: await request.text(),
headers: request.headers,
secret: process.env.SMTPFAST_WEBHOOK_SECRET!,
});
if (event.type !== "inbox.email.received") return new Response(null, { status: 204 });
const { inbox_id, thread_id, email_id } = event.data as { inbox_id: string; thread_id: string; email_id: string };
// The webhook has no body: read the message, with its verdicts.
const base = `${API}/inboxes/${inbox_id}/threads/${thread_id}/emails`;
const res = await fetch(`${base}/${email_id}`, { headers });
if (!res.ok) return new Response(null, { status: 502 }); // SMTPfast retries the webhook
const message = await res.json();
const v = message.verdicts ?? {};
const authenticated = [v.spf, v.dkim, v.dmarc].every((x) => x === "PASS");
// Your model call. The message is data, never instructions, even when it
// passes authentication: the sender's own domain can be the attacker's.
const reply = await yourAgent.draftReply(message, { authenticated });
// A draft, not a send: a person approves it on the Inbound page.
const draft = await fetch(`${API}/inboxes/${inbox_id}/drafts`, {
method: "POST",
headers,
body: JSON.stringify({ thread_id, reply_to_email_id: email_id, to: message.reply_to?.length ? message.reply_to : [message.from], text: reply }),
});
if (!draft.ok) return new Response(null, { status: 502 });
return new Response(null, { status: 204 });
}SMTPfast waits 10 seconds for the answer and retries a webhook that fails or takes longer. If your model is slower, store the event, answer at once and do the work from a queue. A second draft for the same message updates the first one, which can overwrite a person's edits, so skip a message that already has a draft.
To send at once instead of drafting, POST to /v1/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}/reply with a key that has email:send. The reply goes to the sender, from the inbox address, threaded with In-Reply-To and References.
A key with inbound:read and without email:send can read, label and write drafts, and cannot send. The draft waits for a person. Pass the revision they reviewed when you send it, and a draft that changed since is refused with 409 instead of going out unseen.
Each key carries only the scopes you pick, and acts with the role of the person who created it. Creating or deleting an inbox needs an owner or admin key. MCP OAuth tokens expire after 8 hours and renew for up to 30 days; Disconnect revokes them.
SPF, DKIM, DMARC, spam and virus results come with each message, and the MCP tools tell the agent not to act on instructions in a message that fails them. Passing them proves who sent it, not that it is safe to obey: treat every message as data. A message that fails the virus scan is quarantined, and its body is never shown.
Replies, forwards and sent drafts go through the same checks as any other send: a verified domain, the suppression list, your plan's hourly limit, the staged limits of a new account's first week, and spam checks.
Coming: per-inbox send limits and recipient allowlists, webhooks scoped to one inbox, and inboxes with a generated address. Today a webhook receives the events of the whole team, and each event names its inbox.
See pricing, Inbound Email and inbox webhooks.
Yes. Create an inbox for an address on your own domain, such as [email protected] or [email protected], with POST /v1/inboxes or the manage_inbox MCP tool. The domain must be verified for sending and have receiving turned on with an MX record. Receiving needs a paid plan.
Received mail is grouped into threads. The agent lists threads, reads the messages of one with their SPF, DKIM, DMARC, spam and virus verdicts, and then replies in the thread, forwards, labels, archives, or saves a draft for a person to send. Replies carry In-Reply-To and References, so the recipient's mail client keeps the conversation together.
Yes. Give the agent a key with the inbound:read scope and without email:send. It can then read, label and write drafts, but not send. A person reviews the drafts on the Inbound page or sends one through the API with the revision they reviewed; if the draft changed since, nothing is sent.
Yes. The hosted MCP server at https://smtpfa.st/api/mcp has tools for inboxes, threads, labels, drafts, replies and received email. Clients that support MCP authorization connect with OAuth and no pasted key; others send an API key as a bearer token.
Subscribe a webhook to inbox.email.received. It fires once for each received message filed into a thread and carries the inbox, thread and message ids, but no body, so the agent fetches the message through the API. Webhooks need a paid plan.
It follows Resend's Inboxes API, so code written for it works with the SMTPfast base URL and an SMTPfast key. The docs list the differences, for example that SMTPfast never hands out addresses on a shared domain.