cloudflare-email-service

Send and receive transactional emails using Cloudflare Email Service bindings, REST API, and Email Routing.

Updated Nov 23, 2024
One-click install
npx skills add https://github.com/tokisakiyuu/dotfiles --skill cloudflare-email-service-tokisakiyuu
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cloudflare-email-service
Source: https://github.com/tokisakiyuu/dotfiles/tree/main/home/dot_claude/skills/cloudflare-email-service
Command: npx skills add https://github.com/tokisakiyuu/dotfiles --skill cloudflare-email-service-tokisakiyuu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires postal-mime, mimetext, agents, and includes references (resource) components.

What problem does it solve? Integrating transactional email into applications requires navigating Cloudflare Email Service's evolving APIs, domain onboarding, DNS authentication, and subtle differences between the Workers binding and REST API. This Skill provides up-to-date guidance, retrieval sources, and common-mistake fixes so agents and developers configure email correctly the first time. ## Core Features & Use Cases - Send emails from Workers or external apps: Use the send_email binding in Workers or the REST API from Node.js, Python, Go, or coding agents via wrangler CLI and MCP tools. - Receive and route inbound email: Implement the Workers email() handler to forward, reply, reject, or parse messages with postal-mime, including store-and-reply-later patterns with Durable Objects. - Deliverability and monitoring: Configure SPF/DKIM/DMARC, manage suppression lists, check sending quotas, and query GraphQL analytics datasets for delivery metrics. - Use Case: A developer asks an AI agent to add a welcome email to their Worker. The Skill ensures the domain is onboarded via wrangler email sending enable, the binding is declared in wrangler.jsonc, and both html and text bodies are sent. ## Quick Start Ask the agent to add a welcome email to your Cloudflare Worker using the send_email binding and verify the sending domain is onboarded.

Frequently Asked Questions about cloudflare-email-service

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I send an email from a Cloudflare Worker?▼

Add a send_email binding to wrangler.jsonc, then call env.EMAIL.send() with to, from, subject, and html or text fields. The from domain must first be onboarded with wrangler email sending enable yourdomain.com.

What is the difference between the Workers binding and the REST API for Cloudflare email sending?▼

The Workers binding uses email in the from object and camelCase fields like replyTo, while the REST API uses address and snake_case fields like reply_to. The REST API returns delivered, permanent_bounces, and queued arrays instead of a messageId.

How do I receive and parse incoming emails with Email Routing?▼

Export an email() handler from your Worker and create a routing rule pointing addresses to it. Buffer message.raw once with new Response(message.raw).arrayBuffer(), then parse it with postal-mime to access subject, text, and attachments.

Why does my Cloudflare email send fail with E_SENDER_NOT_VERIFIED?▼

This error means the from domain has not been onboarded to Email Sending. Run wrangler email sending enable yourdomain.com or onboard the domain in the Dashboard, which auto-adds the required SPF and DKIM records.

Can I use Cloudflare Email Service for marketing or bulk email campaigns?▼

No. Email Service is restricted to transactional email triggered by user actions, such as signups, password resets, and order confirmations. Marketing newsletters and bulk campaigns require a dedicated marketing email platform.

Why does reading message.raw twice return empty content in an email handler?▼

The raw MIME stream is single-use, so a second read returns nothing. Buffer it first with const raw = await new Response(message.raw).arrayBuffer(), then reuse the buffer for parsing or forwarding.