cloudflare-email-routing
БесплатноБез исполняемых скриптовНе проверенGuide to Cloudflare Email Routing, covering both Email Workers for receiving mail and the send_email binding for sending mail from Workers. Covers dashboard…
Об этом скилле
Cloudflare Email Routing
Status: Production Ready ✅ Last Updated: 2025-10-23 Latest Versions: [email protected], [email protected]
What is Cloudflare Email Routing?
Cloudflare Email Routing provides two complementary capabilities:
- Email Workers - Receive and process incoming emails with custom logic (allowlists, blocklists, forwarding, parsing, replying)
- Send Email - Send emails from Workers to verified destination addresses (notifications, alerts, confirmations)
Both capabilities are free and work together to enable complete email functionality in Cloudflare Workers.
Quick Start (10 Minutes)
Part 1: Enable Email Routing (Dashboard)
Prerequisites: Domain must be on Cloudflare DNS
- Log in to Cloudflare Dashboard → select your domain
- Go to Email > Email Routing
- Select Enable Email Routing → Add records and enable
- This automatically adds MX records, SPF, and DKIM to your DNS
- Create a destination address:
- Custom address:
[email protected] - Destination: Your personal email (e.g.,
[email protected]) - Verify the destination address via email
- Custom address:
- ✅ Basic email forwarding is now active
What you just did: Configured DNS and basic forwarding. Now let's add Workers for custom logic.
Part 2: Receiving Emails with Email Workers
1. Install Dependencies
npm install [email protected] [email protected]
Why these packages:
postal-mime- Parse incoming email messages (headers, body, attachments)mimetext- Create email messages for sending/replying
2. Create Email Worker
Create src/email.ts:
import { EmailMessage } from 'cloudflare:email';
import PostalMime from 'postal-mime';
export default {
async email(message, env, ctx) {
// Parse the incoming message
const parser = new PostalMime.default();
const email = await parser.parse(await new Response(message.raw).arrayBuffer());
console.log('From:', message.from);
console.log('To:', message.to);
console.log('Subject:', email.subject);
// Forward to verified destination
await message.forward('[email protected]');
},
};
3. Configure Wrangler
Update wrangler.jsonc:
{
"name": "email-worker",
"main": "src/email.ts",
"compatibility_date": "2025-10-11"
}
4. Deploy and Bind
npx wrangler deploy
# In Cloudflare Dashboard:
# Email > Email Routing > Email Workers
# Select your worker → Create route → Enter address (e.g., [email protected])
What you just did: Created a Worker that logs and forwards emails.
Part 3: Sending Emails from Workers
1. Configure Send Email Binding
Update wrangler.jsonc:
{
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2025-10-11",
"send_email": [
{
"name": "EMAIL",
"destination_address": "[email protected]"
}
]
}
CRITICAL: destination_address must be:
- A domain where you have Email Routing enabled
- A verified destination address in Email Routing settings
2. Send Email from Worker
import { EmailMessage } from 'cloudflare:email';
import { createMimeMessage } from 'mimetext';
export default {
async fetch(request, env, ctx) {
// Create email message
const msg = createMimeMessage();
msg.setSender({ name: 'My App', addr: '[email protected]' });
msg.setRecipient('[email protected]');
msg.setSubject('Welcome to My App');
msg.addMessage({
contentType: 'text/plain',
data: 'Thank you for signing up!',
});
// Send via binding
const message = new EmailMessage(
'[email protected]',
'[email protected]',
msg.asRaw()
);
await env.EMAIL.send(message);
return new Response('Email sent!');
},
};
3. Deploy
npx wrangler deploy
What you just did: Configured your Worker to send emails to verified addresses.
Email Workers: Complete Guide
Runtime API
EmailEvent Handler
export default {
async email(message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext) {
// Process email here
},
};
Parameters:
message- ForwardableEmailMessage objectenv- Environment bindings (KV, D1, secrets, etc.)ctx- Execution context (waitUntil for async operations)
ForwardableEmailMessage Properties
interface ForwardableEmailMessage {
readonly from: string; // Sender email
readonly to: string; // Recipient email
readonly headers: Headers; // Email headers
readonly raw: ReadableStream; // Raw email message
readonly rawSize: number; // Size in bytes
// Methods
setReject(reason: string): void;
forward(rcptTo: string, headers?: Headers): Promise<void>;
reply(message: EmailMessage): Promise<void>;
}
Common Patterns
Pattern 1: All
Установить cloudflare-email-routing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cloudflare-email-routing?
Guide to Cloudflare Email Routing, covering both Email Workers for receiving mail and the send_email binding for sending mail from Workers. Covers dashboard setup with MX, SPF and DKIM records, the email() handler and ForwardableEmailMessage, parsing with postal-mime, composing with mimetext and cloudflare:email EmailMessage, allowlists and blocklists, conditional forwarding, and automatic replies. Documents 8 known issues including Email Trigger not available, unverified destination addresses, Gmail rate limiting, SPF permerror, failed to call worker, and limited free-plan debugging. Use when enabling email routing, writing or configuring an Email Worker, sending notifications or alerts from a Worker, parsing incoming email, configuring MX records, or troubleshooting mail that is not forwarding or delivering.
Как установить скилл cloudflare-email-routing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cloudflare-email-routing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic