EmailSendingSubdomain
Source:
src/Cloudflare/Email/SendingSubdomain.ts
Registers a Cloudflare Email Sending subdomain on a zone, enabling the account to send transactional email from addresses on that subdomain.
Creating the subdomain provisions DKIM, SPF, and return-path
configuration; for zones on Cloudflare DNS the required DNS records are
created automatically and enabled flips to true once they validate
(usually immediately).
The resource is existence-only: the API offers create, get, list, and
delete but no update, so changing name or zoneId triggers a
replacement.
Safety: sending subdomains carry no ownership markers. When there is no
prior state, read scans the zone for an existing subdomain with the
same name and reports it as Unowned, so the engine refuses to take it
over unless --adopt (or adopt(true)) is set.
Registering a sending subdomain
Section titled “Registering a sending subdomain”const sending = yield* Cloudflare.EmailSendingSubdomain("Mail", { zoneId: zone.zoneId, name: "mail.example.com",});// sending.enabled — true once DNS records validated// sending.dkimSelector / sending.returnPathDomain — provisioned configExternally-hosted zones
Section titled “Externally-hosted zones”import * as emailSending from "@distilled.cloud/cloudflare/email-sending";
// For zones not on Cloudflare DNS, fetch the expected records and add// them at your DNS host; `enabled` flips to true once they validate.const records = yield* emailSending.getSubdomainDns.items({ zoneId: sending.zoneId, subdomainId: sending.subdomainId,}).pipe(Stream.runCollect);