| [ Web Proxy ] |
| Viewing: https://www.cloudflare.com/products/email-service/ | [Back] [Original] |
Email Service
Built for Agents
Give agents a real inbox and the ability to send, receive and reply without stitching together third-party tools.
Programmable by default
Route inbound email to Workers, process with AI, store attachments, and trigger workflows with code
One platform, bidirectional email
Combine email routing and email sending to handle the full email lifecycle on one platform.
Join thousands of developers who've eliminated infrastructure complexity and deployed globally with Cloudflare. Start building for free no credit card required.
[Background Pattern] export default { async fetch(request, env) { await env.SEND_EMAIL.send({ to: [{ email: 'user@example.com' }], from: { email: 'notifications@your-domain.com', name: 'Your App' }, subject: 'Your order has shipped', text: 'Your order #1234 has shipped and is on its way.', });
return new Response('Email sent'); },};export default { async email(message, env, ctx) { const raw = await new Response(message.raw).text();
await env.EMAIL_QUEUE.send({ from: message.from, to: message.to, raw, }); },};import { Agent, routeAgentEmail } from 'agents';import { createAddressBasedEmailResolver, type AgentEmail } from 'agents/email';import PostalMime from 'postal-mime';
export class SupportAgent extends Agent { async onEmail(email: AgentEmail) { const raw = await email.getRaw(); const parsed = await PostalMime.parse(raw);
const emails = this.state.emails || []; emails.push({ from: email.from, subject: parsed.subject, body: parsed.text, receivedAt: new Date().toISOString(), });
this.setState({ ...this.state, emails });
await this.replyToEmail(email, { fromName: 'Support Agent', body: `We received your message about "${parsed.subject}".`, }); }}
export default { async email(message, env) { await routeAgentEmail(message, env, { resolver: createAddressBasedEmailResolver('SupportAgent'), }); },};Send transactional emails
Send from your appDeliver transactional and workflow email directly from Workers with a native binding.Receive inbound email
Route inbound email into Workers for parsing, automation, and downstream processing.Build an email-native agent
Use the Agents SDK to maintain state across conversations and reply from the same platform.Use Email Sending for outbound delivery and Email Routing for inbound handling, all from the same Workers application.
Send from Workers
Trigger transactional and workflow email directly from application logic.Route inbound email
Receive mail on your domain and hand it to Workers for processing.Enrich and orchestrate
Classify content with AI, store attachments, and fan out async work with Queues.Reply or escalate
Respond automatically, update state, or hand off to downstream systems and humans.| Web Proxy Viewer | New URL | Original Page |