Cloudflare Email Worker as a Service / API

Cloudflare Email Worker as a Service / API

A private api/worker service for sending email powered by Cloudflare worker project.

willin/cloudflare-send-email-service - GitHub

Prepare Job

  1. Prepare a domian, such as Now, add a website in cloudflare-dashboard and build your domain. It maybe cost you about 30min.
  2. Select your site and domain, Enable Email Routing. It maybe cost you about 5min.
  3. Install warngler for delpoy cf worker. Ensure your node version >= 16.13.0 and run :
npm install wrangler@latest -g


  1. Get the code
git clone [email protected]:willin/cloudflare-send-email-service.git
  1. Deploy your worker
wrangler deploy  --name send-email-worker-service
  1. Config DNS records

Add a TXT record to your domain with the following values:

  • Name:
  • Value: v=spf1 a mx ~all

Note: If you're facing Domain Lockdown error, follow the below steps:

  • Name:
  • Value: v=mc1 (the value of cfid will also be present in the error response)
  1. Setup DKIM

This step is optional, but highly recommended. DKIM is a DNS record that helps prevent email spoofing. You may follow the steps listed in the MailChannels documentation to set up DKIM for your domain.

API Documentation






sender_emailstringThe email address of the sender.
sender_namestringThe name of the sender.
recipient_emailstringThe email address of the recipient.
subjectstringThe subject of the email.
messagestringThe message body of the email.

Example Request

curl -d"[email protected]&sender_name=Demo&[email protected]&subject='Hello Guy!'&msg_data='My first email sent!'" ""
The End