cloudflare-email-service

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

Updated Oct 15, 2019
One-click install
npx skills add https://github.com/kkkaoru/dotfiles --skill cloudflare-email-service-kkkaoru
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudflare-email-service
Source: https://github.com/kkkaoru/dotfiles/tree/main/.agents/skills-stroage/cloudflare-email-service
Command: npx skills add https://github.com/kkkaoru/dotfiles --skill cloudflare-email-service-kkkaoru

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Adding transactional email to an application involves confusing setup steps: domain onboarding, SPF/DKIM records, choosing between a Workers binding and a REST API, and avoiding subtle field-name differences that cause failed sends. This Skill guides you through Cloudflare Email Service configuration, sending, receiving, and deliverability monitoring with current, retrieval-first documentation. ## Core Features & Use Cases - Send emails from Workers or external apps: Use the send_email binding in a Worker, the REST API from Node.js/Python/Go, or the Agents SDK onEmail()/replyToEmail() methods for AI agents. - Receive and route inbound email: Implement the email() handler to forward, reply, reject, or parse messages with postal-mime, including a store-and-reply-later Durable Object pattern. - Manage deliverability: Handle bounces, suppression lists, sending limits, and GraphQL analytics for delivery monitoring. - Use Case: A coding agent needs to add a "deployment complete" notification email to a CI pipeline. The Skill provides the exact wrangler command to onboard the domain and the correct REST API payload with address (not email) in the from object. ## Quick Start Ask the agent to add email sending to your Cloudflare Worker using the send_email binding and onboard your domain with wrangler.

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 with name EMAIL, then call env.EMAIL.send() with to, from, subject, and html or text fields. The from domain must first be onboarded with npx wrangler email sending enable yourdomain.com.

How do I send emails with the Cloudflare Email REST API?

POST to https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send with a Bearer API token. Note the REST API uses address instead of email in the from object and reply_to instead of replyTo, unlike the Workers binding.

How do I receive and parse incoming emails in a Worker?

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 since the raw stream is single-use.

Why does my Cloudflare email send fail with sender not verified?

The from address must use a domain onboarded to Email Sending before the first send. Run npx wrangler email sending enable yourdomain.com or onboard the domain in the Dashboard, which also configures SPF and DKIM records.

Can I use Cloudflare Email Service for marketing campaigns?

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

What is the difference between the Workers binding and REST API for attachments?

The Workers binding accepts raw strings or ArrayBuffer content for attachments, while the REST API requires base64-encoded strings. Inline images use contentId in Workers versus content_id in the REST API, referenced in HTML as cid: URLs.