All skills
cloudflare avatar

/cloudflare-email-service

@41e0d19 official
by cloudflarecloudflare/skills3k stars
298

Implement or troubleshoot Cloudflare Email Sending and Email Routing integrations and their delivery configuration.

Use this Skill: https://skilld.dev/gh/cloudflare/skills/cloudflare-email-service

This session only. Nothing lands on disk.

referencescli-and-mcp.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

CLI, MCP, and Project Setup

Manage Cloudflare Email Service from the command line and coding agents.

For full CLI reference, run npx wrangler email --help. For Dashboard setup, see the getting started docs.

Wrangler Email Commands

wrangler email routing
├── enable/disable   <domain>          # Toggle email routing
├── dns get          <domain>          # Show required DNS records
├── rules list/create/update/delete    # Manage routing rules
└── addresses list/create/delete       # Destination addresses (account-scoped)

wrangler email sending
├── enable/disable   <domain>          # Toggle email sending
├── dns get          <domain>          # Show sending DNS records (SPF, DKIM)
├── send             --from --to ...   # Send an email (builder flags)
└── send-raw         --from --to ...   # Send a raw MIME email

Domain Setup

Via Dashboard

  1. Navigate to Compute & AI > Email Service > Email Sending (or Email Routing)
  2. Select Onboard Domain > choose domain > Add records and onboard

This auto-adds SPF (TXT) and DKIM (CNAME/TXT) records. DNS usually propagates within 5-15 minutes.

Via CLI

npx wrangler email sending enable yourdomain.com
npx wrangler email sending dns get yourdomain.com   # Verify records

Local Development

Add "remote": true to send real emails during wrangler dev:

{ "send_email": [{ "name": "EMAIL", "remote": true }] }
npx wrangler dev

Emails are actually sent — use test addresses you control. Remove "remote": true before deploying.

Cloudflare MCP Server

If you have the Cloudflare MCP server (https://mcp.cloudflare.com/mcp) configured, you can manage Email Service through its search and execute tools.

Use search to find email sending endpoints:

// search tool — find all email sending API endpoints
async () => {
  const results = [];
  for (const [path, methods] of Object.entries(spec.paths)) {
    if (path.includes('email/sending')) {
      for (const [method, op] of Object.entries(methods)) {
        results.push({ method: method.toUpperCase(), path, summary: op.summary });
      }
    }
  }
  return results;
}

Then use execute to call them — for example, checking sending limits or sending an email:

// execute tool — check sending quota
async () => {
  return cloudflare.request({
    method: "GET",
    path: `/accounts/${accountId}/email/sending/limits`
  });
}

// execute tool — send an email
async () => {
  return cloudflare.request({
    method: "POST",
    path: `/accounts/${accountId}/email/sending/send`,
    body: {
      to: "user@example.com",
      from: { address: "notifications@yourdomain.com", name: "My App" },
      subject: "Deployment Complete",
      html: "<h1>Deployed!</h1>",
      text: "Deployed!"
    }
  });
}

GraphQL analytics queries also work through execute — see deliverability.md for query examples. Note that email analytics are zone-level datasets (emailSendingAdaptiveGroups, emailSendingAdaptive) queried under viewer > zones, and require the Analytics Read token permission.

Sending from CLI / Agents

npx wrangler email sending send \
  --from "agent@yourdomain.com" \
  --to "developer@company.com" \
  --subject "Deployment Complete" \
  --text "Your Worker was deployed successfully."

Or via REST API:

curl "https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/email/sending/send" \
  --header "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{
    "to": "developer@company.com",
    "from": {"address": "agent@yourdomain.com", "name": "Build Agent"},
    "subject": "Deployment Complete",
    "text": "Your Worker was deployed successfully."
  }'

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides documentation and implementation guides for the Cloudflare Email Service. It includes security considerations regarding the handling of untrusted email data and the use of external development tools, all of which are consistent with the skill's intended purpose.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: MEDIUM · 1 issue

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 41e0d19. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 hours ago.

Activeupdated 7 hours ago
  • Python
  • cloudflare
  • email-sending
  • email-routing
  • workers
  • transactional-email
  • rest-api
  • nodejs
  • golang

README badge

README badge for cloudflare/skills/cloudflare-email-service

Send transactional emails and route incoming messages using Cloudflare Email Service, with Workers bindings, REST API, or the Agents SDK. Use this skill for email setup, authentication (SPF/DKIM/DMARC), deliverability tuning, and integrating email into Workers, Node.js, Python, Go, or any AI coding agent.

Generated from the current SKILL.md.

Does this skill cover both sending and receiving emails?
Yes. It covers Email Sending (transactional emails via Workers binding or REST API) and Email Routing (inbound email handling with the `email()` handler). The references are split by use case.
Can I use this skill outside of Cloudflare Workers?
Yes. The REST API works from Node.js, Python, Go, or any external app. You'll need a Cloudflare API token and account ID instead of a binding.
Do I need to set up my domain before sending?
Yes. The domain must be onboarded to Email Sending first via `wrangler email sending enable yourdomain.com` or the Cloudflare Dashboard. The `from` address must use an onboarded domain.
What's the difference between the Workers binding and the REST API?
The Workers binding requires no API keys and uses camelCase field names (`email`, `replyTo`). The REST API uses snake_case (`address`, `reply_to`) and requires a Bearer token, but works outside Workers.
Can I use this for marketing emails or newsletters?
No. Email Service is for transactional emails only. Use a dedicated marketing platform for bulk sends and campaigns.

Generated from the current SKILL.md. These answers refresh after source changes.