How to Send Emails from Shopify Flow Using Cloudflare Email Service

How to Send Emails from Shopify Flow Using Cloudflare Email Service

Shopify Flow can automate a lot, but it can’t send a custom email on its own: no order confirmations in your own words, no internal alerts, no win-back messages outside Shopify’s default notifications. MailAction fixes that with a Send transactional email action that routes each message through an email provider you choose.

Cloudflare Email Service is Cloudflare’s newer transactional email offering (currently in beta). It’s designed for developers using its REST API or Workers binding, but it also exposes a plain authenticated SMTP endpoint, which is what lets you connect it to MailAction with just a host, port, username, and password instead of building an API integration. A few things make this setup different from other providers, so read the steps closely: your sending domain has to be on Cloudflare DNS and onboarded for Email Sending, the connection is port 465 with implicit TLS only (no port 587/STARTTLS), and the credentials are unusual, the username is the literal text api_token and the password is a Cloudflare API token. This guide walks through all of it.

Because the service is in beta, treat it accordingly: it’s transactional-only for now, and the details below can change as Cloudflare develops it.

What You'll Need

Step 1Onboard Your Domain for Email Sending

Cloudflare will only send from a domain you’ve onboarded, and that domain must already be using Cloudflare DNS.

In the Cloudflare dashboard, go to Email Service → Email Sending and select Onboard Domain. Pick a domain from your account, continue to the DNS step, and choose Add records and onboard. Cloudflare adds the records it needs automatically: MX records on a cf-bounce subdomain for bounce handling, plus TXT records for SPF, DKIM, and DMARC so your mail is authenticated.

DNS changes usually take effect within a few minutes for Cloudflare-managed domains, occasionally up to 24 hours. Once the domain shows as onboarded, you can send from any address on it.

Step 2Create an API Token (This Is Your SMTP Password)

Cloudflare doesn’t use a separate “SMTP password”, it uses an API token as the password. Create one with exactly the right permission.

In the Cloudflare dashboard, go to My Profile → API Tokens (or the account-level API tokens area), create a token, and give it the Email Sending: Edit permission. An account-owned token is recommended over a user-owned one. Create it and copy the token now, Cloudflare shows it only once.

Treat this token like a password: anyone who has it can send email from any onboarded domain on the account.

Step 3Know Your Cloudflare SMTP Settings

This is where Cloudflare differs most from other providers, so check each value:

The username catches almost everyone out: it really is the word api_token, the same for every account. Your actual token goes in the password field.

Step 4Install MailAction on Your Shopify Store

Install MailAction from the Shopify App Store and accept the requested permissions.

On first launch, MailAction shows a short setup checklist: set your sender name and email, connect a provider, and send a test email. The next step covers connecting Cloudflare over SMTP.

Step 5Connect Cloudflare to MailAction

In MailAction, open Settings, find Email delivery, and click Manage providers to open the Connect email provider dialog.

Pick SMTP from the provider list and fill in: host smtp.mx.cloudflare.net, port 465 (MailAction treats 465 as TLS from the first handshake, which is what Cloudflare needs), api_token as the username, and your API token as the password. Make sure you use 465 and not 587, Cloudflare will refuse a STARTTLS connection. MailAction tests the connection before saving it, so a wrong port, the token in the wrong field, or a missing permission shows up immediately rather than after your first real send.

Set the sender address (in MailAction’s sender details, or under Override sender) to an address on your onboarded domain. Cloudflare rejects mail from a domain it hasn’t onboarded.

Click Connect. Whichever provider you connect first becomes your Primary, and MailAction routes all outbound mail through it. You can connect a second provider later as an automatic Fallback.

Step 6Create Your First Flow Trigger

Open Shopify Flow, create a new workflow, and pick a trigger (Order created is a common one to start with). Add the Send transactional email action; it shows up in the action list once MailAction is installed.

You’ll need to fill in a few fields on the action: an email address for the recipient (this can pull straight from the trigger, like the customer’s email), a subject line, and the body, which is the actual HTML content of the email. There’s also an optional preview text field for the snippet shown in inbox previews. For the body, you can write plain HTML or use Liquid to pull in order details, customer names, and other data from the workflow.

Save the workflow and turn it on.

Step 7Test Your Setup

Before you trust a live trigger, use the Send test email button in MailAction’s settings. It confirms Cloudflare is wired up correctly and shows you where the message lands.

Once that test email arrives, run your Flow workflow under real conditions, like placing a test order, and check MailAction’s delivery log to confirm the email went out through Cloudflare and see its delivery status.

Common Issues

“535 5.7.8 Authentication failed”

“550 5.7.1 Sender denied”

TLS handshake error, or the connection won’t establish

“552 5.3.4 Message too big”

Sends are deferred, rejected, or you hit a recipient limit