Skip to content

Send bindings

When you add a send_email binding to a Worker, you can restrict its sender and recipient addresses. The following Wrangler configuration variants apply these restrictions. For the binding API, refer to the Email Sending Workers API.

Binding types

Each send_email entry supports a different restriction choice. The sender address must belong to an onboarded Email Service domain.

  • No restriction attribute: The binding adds no recipient restriction of its own. Your plan still limits who you can send to: on the Workers Free plan, only verified destination addresses.
  • destination_address: The binding can only send to the single destination address configured here. If you call send() with a raw EmailMessage whose recipient is empty, the configured address is used. A structured send() call must still set to, cc, or bcc.
  • allowed_destination_addresses: The binding can only send to addresses listed in this allowlist.
  • allowed_sender_addresses: The binding can only send from the addresses listed in this allowlist.

A send to a recipient outside destination_address or allowed_destination_addresses fails with E_RECIPIENT_NOT_ALLOWED. A send from an address outside allowed_sender_addresses fails with E_SENDER_NOT_VERIFIED. Refer to error codes.

{
	"send_email": [
		// No restriction
		{ "name": "EMAIL" },
		// Send only to a single fixed destination
		{
			"name": "NOTIFY_OPS",
			"destination_address": "ops@yourdomain.com",
		},
		// Send only to addresses on an allowlist
		{
			"name": "EMAIL_TEAM",
			"allowed_destination_addresses": [
				"alice@yourdomain.com",
				"bob@yourdomain.com",
			],
		},
		// Send only from addresses on an allowlist
		{
			"name": "RESTRICTED_EMAIL",
			"allowed_sender_addresses": [
				"noreply@yourdomain.com",
				"support@yourdomain.com",
			],
		},
	],
}
[[send_email]]
name = "EMAIL"

[[send_email]]
name = "NOTIFY_OPS"
destination_address = "ops@yourdomain.com"

[[send_email]]
name = "EMAIL_TEAM"
allowed_destination_addresses = [ "alice@yourdomain.com", "bob@yourdomain.com" ]

[[send_email]]
name = "RESTRICTED_EMAIL"
allowed_sender_addresses = [ "noreply@yourdomain.com", "support@yourdomain.com" ]

Next steps

Was this helpful?