Skip to content
Browse documentation
On this page

Email

Send transactional email with Cloudflare Email Sending, or switch to another provider.

Emberstack sends email through Cloudflare Email Sending using the EMAIL binding in wrangler.jsonc. There's no API key. The Worker's binding is the credential.

Onboard your domain

The address you send from must be on a domain that's onboarded for Email Sending. The domain needs to be a zone on your Cloudflare account.

bunx wrangler email sending enable yourdomain.com
bunx wrangler email sending list

Enabling it adds the bounce MX, SPF, DKIM and DMARC records to the zone for you.

Senders

There are two senders to set:

Sender

Where

Used for

EMAIL_FROM

vars in wrangler.jsonc

The app's own email via sendEmail()

cloudflareEmail({ from })

astro.config.mjs

EmDash's admin invites and sign-in links

Sending

import { sendEmail } from '@/lib/email.server';

await sendEmail({
  to: 'person@example.com',
  subject: 'Welcome to the team',
  text: 'Thanks for joining.',
});

from defaults to EMAIL_FROM; pass from: 'Name <address@yourdomain.com>' to override it. sendEmail() sends plain text. Add an html field to EmailBody in src/lib/email.server.ts if you want HTML email.

Other providers

Set the EMAIL_PROVIDER secret to resend, postmark, sendgrid, mailgun or autosend, plus that provider's key (for example RESEND_API_KEY), and sendEmail() uses it instead. Each key is declared in the env schema in astro.config.mjs.