Send transactional emails with Resend and Encore. Emails are delivered asynchronously via Pub/Sub so your API endpoints stay fast.
- Resend SDK initialized with an Encore secret
- Pub/Sub topic for async email delivery with automatic retries
- Send endpoint that publishes email events and returns immediately
- Frontend at
/with a form to send test emails
You'll need a Resend account:
- Create an API key. Go to API Keys and create a new key.
- Verify a domain (optional for testing). Go to Domains to add your sending domain. Until you verify a domain, the example uses
onboarding@resend.devas the default sender, which works with any Resend API key.
-
Install Encore if you haven't already:
curl -L https://encore.dev/install.sh | bash -
Create a new app from this example:
encore app create --example=ts/resend
-
Set your Resend API key:
encore secret set --type local ResendAPIKey
-
Run the app:
encore run
-
Open http://localhost:4000 to send a test email.
The example defaults to onboarding@resend.dev (Resend's built-in test sender). To use your own address, verify your domain in Resend and update the from field in email/topic.ts.