Send emails with named recipient addresses
You can now send emails with display names on recipient addresses in addition to the existing from support. Pass an object with email and an optional name field for to, cc, bcc, replyTo, or from:
export default { async fetch(request, env) { const response = await env.EMAIL.send({ from: { email: "support@example.com", name: "Support Team" }, to: { email: "jane@example.com", name: "Jane Doe" }, cc: [ "manager@company.com", { email: "team@company.com", name: "Engineering Team" }, ], subject: "Welcome!", html: "<h1>Thanks for joining!</h1>", text: "Thanks for joining!", });
return Response.json({ messageId: response.messageId }); },};export default { async fetch(request, env): Promise<Response> { const response = await env.EMAIL.send({ from: { email: "support@example.com", name: "Support Team" }, to: { email: "jane@example.com", name: "Jane Doe" }, cc: [ "manager@company.com", { email: "team@company.com", name: "Engineering Team" }, ], subject: "Welcome!", html: "<h1>Thanks for joining!</h1>", text: "Thanks for joining!", });
return Response.json({ messageId: response.messageId }); },} satisfies ExportedHandler<Env>;Plain strings remain fully supported for backward compatibility, and you can mix strings and named objects in the same array.
Refer to the Workers API and REST API documentation for full request examples.