What an agent needs from email
- To hear about new mail at once, not by polling a mailbox every minute.
- To read the whole conversation: earlier messages, attachments, what was already answered.
- To send from a real address on your domain, signed with DKIM so replies don't land in spam.
- A person who can look over its shoulder, correct an answer or take over a conversation.
- Limits, so a loop in your code can't send ten thousand emails.
A sending API covers the third point only. A normal mailbox covers the first four, but its API is built for one person's account, not for software. Mektup is a mailbox built to be used by both.
How it works
- Someone writes to
support@yourcompany.com. Mektup's mail servers receive it, check it for spam and store it in the mailbox. - Mektup posts the message to your agent's webhook as soon as it is stored, signed with your webhook secret.
- Your agent reads the message, and if it needs more, the thread and attachments through the API.
- It replies with one API call or the
send_emailMCP tool, passing the message's id asinReplyTo. The reply goes out fromsupport@, DKIM-signed, in the same thread, and is saved in Sent. - Your team sees the whole conversation in webmail or their own mail app.
Set it up
- Add your domain in Mektup (dashboard, API or the
create_domaintool) and add the MX, SPF, DKIM and DMARC records it returns at your DNS host. - Create the mailbox:
POST /v1/domains/yourcompany.com/mailboxeswith{"localPart": "support"}. - Point its webhook at your agent:
PUT /v1/domains/yourcompany.com/mailboxes/support/webhook. The response shows the signing secret once. - Handle the webhook and reply. A complete Node.js example:
import express from "express";
import crypto from "node:crypto";
const app = express();
app.post("/inbound", express.raw({ type: "application/json" }), async (req, res) => {
// 1. Check that the call came from Mektup
const expected = crypto.createHmac("sha256", process.env.MEKTUP_WEBHOOK_SECRET)
.update(req.body).digest("hex");
const got = String(req.get("X-Mektup-Signature") || "").replace("sha256=", "");
if (got.length !== expected.length ||
!crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected))) {
return res.sendStatus(401);
}
res.sendStatus(200); // answer within 8 seconds, do the work after
// 2. Let your agent decide what to say
const { mailbox, message } = JSON.parse(req.body);
const answer = await runAgent(message); // your model call
// 3. Reply from the same address
await fetch("https://api.usemektup.com/v1/emails", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MEKTUP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: mailbox,
to: message.from,
subject: `Re: ${message.subject}`,
text: answer,
inReplyTo: message.id, // keeps the reply in the same thread
}),
});
});
app.listen(3000);An open-source version with a model call and a human safety net is on GitHub: mektup-inbox-agent.
Or let the agent do it through MCP
Agents in Claude Code, Claude Desktop, Cursor, Lovable or Replit can use Mektup as tools: create_domain, get_domain_records, create_mailbox, set_mailbox_webhook, list_messages, get_thread, send_email and the rest of the API. Add the remote server to your client:
{
"mcpServers": {
"mektup": {
"url": "https://mcp.usemektup.com/mcp",
"headers": { "Authorization": "Bearer mek_live_..." }
}
}
}Clients that support OAuth only need the URL https://mcp.usemektup.com/mcp and sign in with your Mektup account. More on the MCP server.
Limits that protect you
| Limit on Starter | Value |
|---|---|
| Sent recipients a month | 50,000 |
| A day / an hour / per 5 minutes | 2,000 / 300 / 60 |
| Recipients per message | 50 |
| Received mail | Not counted; uses storage (15 GB per account) |
| Mailboxes | Unlimited |
Limits hold on every way out: the API, MCP, SMTP, forms, forwards and auto-replies. Over a limit the API answers 429 and nothing is sent.
Other ways to give an agent email
AgentMail sells inboxes for agents priced per inbox; Hostinger Agentic Mail adds an API and MCP to Hostinger mailboxes; Nylas Agent Accounts host a mailbox inside the Nylas API; Resend and Postmark parse inbound mail into webhooks without a mailbox. How Mektup compares with AgentMail.