Repository navigation
Description
Existing documentation URL(s)
What changes are you suggesting?
The Email Sending Workers API page declares to as a required field of EmailMessageBuilder, and its error table lists "Missing to, from, or subject fields" as the cause of E_FIELD_MISSING. The email binding source migrated from Cloudflare's internal repository makes to, cc, and bcc each optional and rejects a send only when all three are empty; the published @cloudflare/workers-types and the REST API schema agree that to is not required on its own. A reader of the page cannot learn that a bcc-only send, for example, is supported.
Additional information
Runtime or environment
cloudflare/cloudflare-docs production at 2a4bfc47c14e4943329abbb2f741b897c7184071 and the published page as of 2026-11-08. Runtime source: src/workerd/api/email.h and email.c++ in open, unmerged cloudflare/workerd pull request #8222 at head b3267af57e368a5c22e5a5af86fd42bb66d5fdd4, whose description reads "Migrating from the internal repo ... moving into workerd as-is is the first step". Types: @cloudflare/workers-types 5.20261108.1. REST schema: cloudflare/api-schemas at 650bd71c22db3b938a4611bf4cc5afd896b400b7. Local run: wrangler 4.158.0 with its bundled workerd 1.20261104.1 and miniflare 5.20261104.0-beta, compatibility_date 2026-11-01.
Steps to reproduce
- Read the
EmailMessageBuilderinterface and Error codes on the Workers API page (src/content/docs/email-service/api/send-emails/workers-api.mdxlines 49-50 and 188). - Compare with
struct EmailMessageBuilderinsrc/workerd/api/email.hand the recipient check inSendEmail::sendinsrc/workerd/api/email.c++(pull request [ZT] Add egress policies #8222), and withtype EmailDestinationsin@cloudflare/workers-types. - Compare with the request body schema of
POST /accounts/{account_id}/email/sending/sendincloudflare/api-schemasopenapi.json.
Expected behavior
The Workers API reference should state the binding's recipient rule: at least one of to, cc, or bcc is required, and to is optional when cc or bcc is given. The error table should name the condition that produces E_FIELD_MISSING for recipients accordingly.
Actual behavior
The page declares to: string | EmailAddress | (string | EmailAddress)[]; // Max 50 recipients without ?, while cc and bcc are optional, and line 188 lists "Missing to, from, or subject fields". The runtime source declares jsg::Optional<EmailRecipients> to;, jsg::Optional<EmailRecipients> cc;, jsg::Optional<EmailRecipients> bcc; and checks JSG_REQUIRE(recipientTotal > 0, TypeError, "Email must have at least one recipient in \"to\", \"cc\", or \"bcc\"."). The types say "At least one of to, cc, or bcc must be provided." The workerd commit that added these types (d14c8f0c71) describes "optional 'to' when 'cc'/'bcc' is provided (EMAIL-1843)" as a merged runtime change. The REST request schema lists from and subject as required, requires at least one of to, cc, or bcc through allOf/anyOf, and describes to as "Optional if cc or bcc is provided".
Local wrangler dev did not show a successful cc-only send: env.EMAIL.send({ from: "[email protected]", cc: "[email protected]", subject: "Hi", text: "Hi" }) threw TypeError: Cannot read properties of undefined (reading 'email'). That error comes from the local simulator rather than from a documented validation error, so it does not establish the production rule either way.
Evidence
- Expected source:
src/workerd/api/email.h(struct EmailMessageBuilder) andsrc/workerd/api/email.c++(recipient check inSendEmail::send) incloudflare/workerdpull request [ZT] Add egress policies #8222,type EmailDestinationsin@cloudflare/workers-types, and the REST send request schema. - Failure source:
src/content/docs/email-service/api/send-emails/workers-api.mdxlines 50 and 188. - Evidence provenance: static
- Local verification: not-reproduced
- Reproduction completeness: incomplete
- Missing fact: Whether a production
send()with onlyccorbccsucceeds; the investigating account cannot send email.
Production was not tested. The local rerun failed with a simulator TypeError instead of demonstrating either behavior. The production conclusion rests on pull request #8222 reflecting the internal implementation, as its description states, together with the types and the EMAIL-1843 commit message; the pull request is unmerged.
Restoration check
Failing: the Workers API reference marks to as required and names a missing to as an E_FIELD_MISSING cause. Passing: the reference states that at least one of to, cc, or bcc is required and the error table describes the missing-recipient case that way. Control: the documented examples that set to remain valid.
Triage assessment
- Impact level: P3
- Assessment status: provisional
- Impact basis: Following the page still produces working sends, because setting
tois always accepted. Readers are told abcc-only send is invalid when, per the runtime source and types, it is supported. Production behavior is inferred from source, not observed. - Workaround status: available
- Workaround basis: A sender who needs recipients hidden can set
toto an address it controls and put the real recipients inbcc, which the page documents and the runtime accepts; the types describe the full rule.
Activity