Skip to content

SendEmail

Source: src/Cloudflare/Email/SendEmail.ts

A Cloudflare Workers send_email binding descriptor.

SendEmail is a Worker-only binding — it does not create any cloud-side resource. The descriptor names the binding and records optional destination/sender restrictions; the actual send_email entry is attached to the Worker via {@link SendEmailBinding}.

Send to any verified destination

const Email = Cloudflare.SendEmail("Email");
// in the Worker effect:
const email = yield* Cloudflare.SendEmail.bind(Email);
yield* email.send({
from: "noreply@example.com",
to: "user@example.com",
subject: "Hello",
text: "Hi from Alchemy",
});

Restrict the sender address

const Ops = Cloudflare.SendEmail("OpsEmail", {
allowedSenderAddresses: ["noreply@example.com"],
destinationAddress: "ops@example.com",
});