Resend Email Setup
How to configure Resend for transactional email and newsletter subscriptions.
Last updated:
Create a Resend account
- Sign up at resend.com
- Go to API Keys → Create API Key
- Name it (e.g.,
BloggFast Production) and give it Full access - Copy the key — you can only see it once
Verify your domain
For production, verify your sending domain under Domains in the Resend dashboard. Add the DNS records Resend provides to your domain registrar. Without domain verification, emails may land in spam or be limited to Resend's sandbox.
Note
onboarding@resend.dev as the from address to send test emails to your own account without domain verification. Resend's free tier allows 3,000 emails/month.Configure environment variables
RESEND_API_KEY=re_...
RESEND_FROM_EMAIL=hello@yourdomain.com
RESEND_WEBHOOK_SECRET=whsec_... # Optional: for webhook event handling
RESEND_AUDIENCE_ID= # Optional: for Resend Contacts syncEmail flows in BloggFast
BloggFast uses Resend for these email flows (defined in src/lib/resend.ts):
| Function | When it fires | Template |
|---|---|---|
sendSubscriptionConfirmationEmail | When a user submits the newsletter subscription form | HTML with a tokenized confirmation link |
sendWelcomeEmail | After subscription is confirmed via the confirmation link | HTML welcome message |
upsertSubscriberContactInResend | After confirmation — syncs the subscriber to Resend Audiences (if RESEND_AUDIENCE_ID is set) | N/A — API call only |
unsubscribeContactInResend | When a subscriber opts out | N/A — removes from Resend Audience |
Webhook setup (optional)
BloggFast includes a Resend webhook handler at /api/webhooks/resend (via the Svix verification library) that handles bounce and complaint events. To enable:
- In your Resend dashboard, go to Webhooks → Add Endpoint
- Set the URL to
https://yourdomain.com/api/webhooks/resend - Select events:
email.bounced,email.complained - Copy the signing secret → set as
RESEND_WEBHOOK_SECRET
Webhook events automatically update subscriber statuses in the database (BOUNCED, COMPLAINED) and log to the SubscriberEvent table.
Audience sync (optional)
If you want to sync subscribers to a Resend Audience (for broadcast emails), create an audience in the Resend dashboard and add the ID to your environment:
RESEND_AUDIENCE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxIf this variable is not set, the app skips the contact sync step without errors — email sending still works normally for transactional flows.