AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

cloudflare-email-service

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

Original source
cloudflare
License
Apache-2.0
Pinned revision
e44f580f9c4fa3bf268e284ae7706c7954ba31fd

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read cloudflare--cloudflare-email-service at revision e44f580f9c4fa3bf268e284ae7706c7954ba31fd, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 7

references/cli-and-mcp.md

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: "[email protected]",
      from: { address: "[email protected]", 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 "[email protected]" \
  --to "[email protected]" \
  --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": "[email protected]",
    "from": {"address": "[email protected]", "name": "Build Agent"},
    "subject": "Deployment Complete",
    "text": "Your Worker was deployed successfully."
  }'