Bug Report: Email Body Missing When Sent from Cloudflare Worker – DKIM Issue

For Workers & Pages, what is the name of the domain?

Worker originated emails via routes

What is the issue or error you’re encountering

Emails originating from Cloudflare Workers and routed as text/html or text/plain have an empty body in Outlook, and Gmail does not receive them, likely due to the lack of DKIM signing for Worker-originated emails.

What steps have you taken to resolve the issue?

When sending an email from a Cloudflare Worker (that initiates from the Worker and isn’t forwarded), the email body is not being received by the verified email address in Outlook and Gmail is rejecting it. After troubleshooting, it seems the issue might be related to the lack of DKIM signing for emails routed through Cloudflare Email Routing.

While following this community thread, I noticed that Cloudflare has not yet implemented DKIM signing for Email Routing. This absence appears to support the core purpose of Email Routing but in this scenario where Workers should send alerts it is not beneficial.

Additionally, if the email originates from a Worker, there will be no ARC or DKIM headers in the body of the email. As a result, this seems to be a bug in how Email Workers handle email origination and signing.

Another related topic was previously closed due to inactivity, but the issue remains unresolved and is effectively a bug:
Closed Topic: Verified email address not receiving body of email sent from worker: Verified email address not receiving body of email sent from worker

What are the steps to reproduce the issue?

  1. Configure a Cloudflare Worker to send an email through Cloudflare Email Routing, it must initiate from the worker itself.
  2. Send the email to a verified email address.
  3. Check the received email for the presence of the body and DKIM/ARC headers in Outlook, in Gmail it will most likely never hit inbox or spam as it has no DKIM headers.

Expected Behavior:
The email body should be delivered to the recipient, and DKIM signing should be applied to emails sent via Cloudflare Email Routing to ensure proper authentication and delivery.

Actual Behavior:
The email body is missing, and DKIM/ARC headers are not present, potentially causing issues with email verification and delivery.

Questions for the Community:

1.) Can others replicate this issue to confirm if it’s related to the lack of DKIM signing in Cloudflare Email Routing? (also see: Verified email address not receiving body of email sent from worker)
2.) Is the absence of DKIM signing for Worker-originated emails a known limitation or an oversight in the current implementation?
3.) If anyone from Cloudflare sees this, please note this is not a feature request. It is effectively a bug and should not be closed without resolution.

Lack of (RFC) conformance, or otherwise standard violations, can cause display issues in certain email clients

It has been rumoured that Outlook may display an empty body, if there are characters in your message, that do not conform to the set up of your message (e.g. aren’t valid according to your Content-Type & Content-Transfer-Encoding headers).

It is your job, within your Email Worker, to ensure that all email boundaries, such as e.g. the text/html and text/plain parts, are set up properly.

Whether an email has been DKIM signed, or not, that won’t change anything in regards to the email content, or how it is being displayed by email clients.

For DKIM, that is because you haven’t programmed your Email Worker to sign, and add the corresponding signature to them.

So if you want the messages from your Email Worker to be DKIM signed, the code of your Email Worker needs to adjusted, so you’re adding this functionality on your own, within your Email Worker.

Since your Email Worker will be the first step of the message (e.g. the “sender”), the Email Worker should DKIM sign the message.

The ARC will only be relevant for intermediates, that are relaying your message (e.g. other email routing / forwarding services), and as such, isn’t anything an Email Worker, or otherwise the “sender” should do.

The flows are generally like this:

  1. Sender (DKIM) → Final destination.

  2. Sender (DKIM) → Intermediate (ARC) → Final destination.

  3. Sender (DKIM) → Intermediate #1 (ARC) → Intermediate #2 (ARC) → Final destination.

The Email Workers shall literally be seen as a DIY (Do-It-Yourself) in this scenario.

If you want something there, you’re going to have to do it on your own.

That spans everywhere, from ensuring that your message boundaries conform to the standards, to adding the DKIM signing, and so forth.

If you want Cloudflare to take care of the DKIM signing, without you’re adding it in your Email Worker code on your own, then this isn’t a bug, but a feature request.

2 Likes

Greatly appreciated, this answers many questions that were never responded to in the other community post. Just like the others I used mimetext and instructions directly from Send emails from Workers · Cloudflare Email Routing docs, so will investigate this further.

Seperately, regarding DKIM lacking for this Send emails from Workers · Cloudflare Email Routing docs I agree bug was incorrect but I would strongly say feature gap – something that needs to be looked at if the official docs recommend this workflow with a worker initiating the email creation and forcing it through Cloudflare Email Routing (which sets up DMARC and SPF. The docs suggest my use case of sending alerts via email is suitable as it says, " You can send an email about your Worker’s activity from your Worker to an email address verified on Email Routing" – which may not be fit for purpose without DKIM signing in most corporate email environments.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.