Complete guide for Cloudflare Email Routing covering both Email Workers (receiving emails) and Send Email bindings (sending emails from Workers).\n\nUse when: setting up email routing, creating email workers, processing incoming emails, sending emails from Workers, implementing email allowlists/blocklists, forwarding emails with custom logic, replying to emails automatically, parsing email content, configuring MX records for email, troubleshooting email delivery issues, or encountering email worker errors.\n\nPrevents 8 documented issues: "Email Trigger not available" errors, destination address verification bugs, Gmail rate limiting, SPF permerror issues, worker call failures, test event loading issues, activity log discrepancies, and limited debugging on free plans.\n\nKeywords: Cloudflare Email Routing, Email Workers, send email, receive email, email forwarding, email allowlist, email blocklist, postal-mime, mimetext, cloudflare:email, EmailMessage, ForwardableEmailMessage, EmailEvent, MX records, SPF, DKIM, email worker binding, send_email binding, wrangler email, email handler, email routing worker, "Email Trigger not available", "failed to call worker", email delivery failed, email not forwarding, destination address not verified\n
Status: Production Ready ✅ Last Updated: 2025-10-23 Token Savings: ~65% Errors Prevented: 8 documented issues
Claude Code should use this skill when encountering:
Complete knowledge for both:
| Issue | Error | Prevention | |-------|-------|------------| | #1 | "Email Trigger not available" (#3751) | Deploy before testing, use wrangler tail | | #2 | Destination address verification bug | Create regular forward rule first | | #3 | Gmail rate limiting (421) | Implement SPF/DKIM, rate-limit sending | | #4 | SPF permerror with MailChannels | Use native Email Routing capabilities | | #5 | Limited logging on free plan | Use wrangler tail, store logs in D1/KV | | #6 | Activity log shows "Dropped" incorrectly | Test actual delivery, don't rely on dashboard | | #7 | Test Email Event loading indefinitely (#9195) | Use curl with local dev, test with real emails | | #8 | Worker call failures "failed to call worker" (#9069) | Add error handling, timeouts, test various formats |
import PostalMime from 'postal-mime';
export default {
async email(message, env, ctx) {
const parser = new PostalMime.default();
const email = await parser.parse(
await new Response(message.raw).arrayBuffer()
);
console.log('From:', message.from);
console.log('Subject:', email.subject);
await message.forward('you@example.com');
},
};
import { EmailMessage } from 'cloudflare:email';
import { createMimeMessage } from 'mimetext';
// wrangler.jsonc:
// "send_email": [{ "name": "EMAIL", "destination_address": "you@example.com" }]
const msg = createMimeMessage();
msg.setSender({ name: 'App', addr: 'noreply@yourdomain.com' });
msg.setRecipient('user@example.com');
msg.setSubject('Hello');
msg.addMessage({ contentType: 'text/plain', data: 'Hello!' });
await env.EMAIL.send(
new EmailMessage('noreply@yourdomain.com', 'user@example.com', msg.asRaw())
);
skills/cloudflare-email-routing/
├── SKILL.md # Complete guide (this is the main file)
├── README.md # This quick reference
├── templates/ # Working examples
│ ├── wrangler-email.jsonc # Complete wrangler config
│ ├── receive-basic.ts # Simple forward
│ ├── receive-allowlist.ts # Allowlist pattern
│ ├── receive-blocklist.ts # Blocklist pattern
│ ├── receive-reply.ts # Auto-reply pattern
│ ├── send-basic.ts # Send email example
│ └── send-notification.ts # Notification pattern
└── references/
├── common-errors.md # All 8 known issues detailed
├── dns-setup.md # MX, SPF, DKIM configuration
└── local-development.md # Testing patterns with wrangler dev
{
"dependencies": {
"postal-mime": "^2.5.0",
"mimetext": "^3.0.27"
}
}
Verified: 2025-10-23
Claude Code automatically uses this skill when:
No manual invocation needed—Claude discovers this skill via keywords in the description.
Without Skill: ~12,000 tokens + 2-3 errors With Skill: ~4,200 tokens + 0 errors Savings: ~65% tokens, 100% error prevention
❌ Don't use this skill for:
✅ Use this skill for:
Need Help?
SKILL.md for comprehensive guidereferences/common-errors.md for troubleshootingwrangler tail for debuggingnpx skills add jackspace/cloudflare-email-routing下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer