Email-Capable AI Agents at the Edge

Build Cloudflare Workers that send, read, and manage email through MultiMail's API — with human oversight and zero cold starts.


Cloudflare Workers run at the edge with sub-millisecond cold starts, making them ideal for responsive AI agents. By integrating MultiMail, your Workers gain full email capabilities: sending messages, checking inboxes, replying to threads, and managing contacts — all from edge locations worldwide.

MultiMail itself runs on Cloudflare's infrastructure, which means API calls from your Worker to MultiMail stay within Cloudflare's network for minimal latency. The REST API uses standard fetch, which is native to the Workers runtime with no additional dependencies needed.

Combined with Durable Objects for agent state and Workers AI for inference, you can build complete email-handling agents that process incoming messages, draft responses, and manage approval queues entirely at the edge.

Built for Cloudflare Workers developers

Same Network, Low Latency

MultiMail runs on Cloudflare. API calls from your Worker stay within Cloudflare's network, avoiding extra network hops and delivering consistently low response times for email operations.

No Dependencies Required

The Workers runtime has fetch built in. Calling the MultiMail API requires no npm packages — just standard HTTP requests. This keeps your Worker bundle small and deploy times fast.

Durable Object State for Agents

Use Durable Objects to maintain agent state across requests. Track conversation context, pending approvals, and contact history in a Durable Object while using MultiMail for the actual email operations.

Event-Driven Email Processing

Combine MultiMail webhooks with Workers to process incoming emails in real time. When a new email arrives, MultiMail can trigger your Worker to analyze it, draft a response, and queue it for approval.

Workers AI + Email

Use Workers AI for on-device inference to analyze incoming emails, classify intent, and generate responses — then send those responses through MultiMail's API with oversight controls.


Try it with your agent

No code, no dashboard. Paste this to your AI agent — it connects MultiMail, creates an inbox, and builds the flow for you.

1. Get MultiMail ready: read https://multimail.dev/llms.txt, connect the MultiMail MCP server in your agent environment, create a free inbox for this Cloudflare Workers project, and set up a verified sending domain for outbound mail. 2. In the Cloudflare Worker, use Cloudflare Workers' real tool/function calling mechanism for agents. Expose MultiMail-backed tools to the agent by calling the connected MCP server from those tool handlers; do not invent MultiMail endpoints, headers, or direct transport details. 3. Give the agent exactly these capabilities: inbox-check to read recent inbox mail and summarize what needs attention, draft-reply to compose a reply without sending, and send to send or schedule email only through MultiMail. 4. Send a test email from the verified sender to the free inbox, run the Worker locally or in your Cloudflare Workers environment, have the agent check the inbox, draft a reply, and confirm the draft uses the intended sender, recipient, subject, and body. 5. Run MultiMail in gated_send oversight mode for this Worker so every outbound email is held for developer review before it sends. Keep gated_send enabled until the workflow is proven safe; only then consider monitored or autonomous mode.

Step by step

1

Create a MultiMail Account

Sign up at multimail.dev, create a mailbox, and generate an API key.

2

Scaffold a Worker Project

Create a new Cloudflare Worker project using Wrangler.

3

Store Your API Key

Add your MultiMail API key as a Worker secret so it is not exposed in source code.

4

Implement Email Endpoints

Write fetch handlers that call the MultiMail API. Use the env.MULTIMAIL_API_KEY binding for authentication.

5

Deploy and Test

Deploy your Worker and test the email integration. Set up a MultiMail webhook pointing to your Worker URL for incoming email processing.


Common questions

Do I need any npm packages to call the MultiMail API?
No. Cloudflare Workers have fetch built into the runtime. You can call the MultiMail REST API directly with standard HTTP requests. This keeps your Worker bundle minimal and avoids compatibility issues with Node.js-specific packages.
How do I handle MultiMail webhooks in a Worker?
Create a POST endpoint in your Worker that receives webhook payloads from MultiMail. Configure the webhook URL in your MultiMail dashboard to point to your Worker's URL. The Worker processes the event (e.g., new email received) and can reply or take other actions via the API.
Can I use Workers AI with MultiMail?
Yes. Workers AI provides LLM inference at the edge. Use it to analyze incoming emails, generate reply drafts, or classify messages. Then use MultiMail's API to send the generated responses. This keeps the entire pipeline — inference and email delivery — at the edge.
How do Durable Objects help with email agents?
Durable Objects provide persistent state for your agent. You can track which messages have been processed, store conversation context for ongoing threads, maintain a queue of pending actions, and implement rate limiting. The Durable Object persists between Worker invocations.
Is the MultiMail API compatible with the Workers runtime?
Yes. MultiMail's REST API uses standard HTTP with JSON payloads, which is fully compatible with the Workers runtime. There are no Node.js-specific dependencies or WebSocket requirements. All API calls work with the built-in fetch function.
What about email processing latency?
Since both your Worker and MultiMail run on Cloudflare's network, API calls benefit from internal routing with minimal network hops. A typical send or inbox check completes in under 100ms. Combined with Workers' zero cold start times, your email agent responds near-instantly.

Explore more

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a hosted MCP server. Formally verified in Lean 4.