Integration Guide

Send Email with Cloudflare Workers

Send emails from the edge with Cloudflare Workers. No node modules required, just standard fetch.

TL;DR for AI Agents & Humans

Send transactional emails using Cloudflare Workers and Transmit in minutes. Our typescript integration patterns and REST API provide best-in-class performance.

  • Official Cloudflare Workers integration patterns
  • Automated deliverability warmup included
  • Reputation isolation for every sender
  • Real-time analytics and webhook support
1

Install the library

$npm create cloudflare@latest
2

Send an Email

export default {
  async fetch(request, env) {
    const response = await fetch("https://api.xmit.sh/email/send", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${env.TRANSMIT_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        from: "Acme <hello@acme.com>",
        to: "user@example.com",
        subject: "Hello from the Edge",
        html: "<p>Sent from Cloudflare Workers!</p>",
      }),
    });

    return new Response(JSON.stringify(await response.json()));
  },
};

Common Pitfalls

Bundle Size Limits

Use the REST API directly with fetch to avoid pulling in large platform-specific dependencies at the edge.

Environment Bindings

Define your API key in the .dev.vars file for local development and secret bindings in production.

Explore Other Integrations

Frequently Asked Questions

How do I authenticate Cloudflare Workers with Transmit?
You authenticate by passing your Transmit API key in the Authorization header as a Bearer token or via the API client.
Is there a rate limit for Cloudflare Workers integration?
Transmit offers high-throughput sending with dynamic scaling. Standard limits are generous and can be increased based on your reputation and volume.