Email Flows
How BloggFast handles email subscriptions and transactional emails via Resend.
Last updated:
Email subscription flow
BloggFast includes a newsletter subscription form. When a visitor subscribes:
- Email address is validated and submitted to
/api/subscribers - A new
Subscriberrecord is created in Postgres with statusPENDING - A tokenized confirmation email is sent via Resend (
sendSubscriptionConfirmationEmail) - When the subscriber clicks the confirmation link (
/api/subscribers/confirm?token=...), their status updates toACTIVE - A welcome email is sent (
sendWelcomeEmail) - If
RESEND_AUDIENCE_IDis set, the contact is synced to Resend Audiences
Transactional emails
BloggFast sends the following transactional emails (all defined in src/lib/resend.ts):
| Trigger | |
|---|---|
| Subscription confirmation | Immediately when a user submits the subscription form |
| Welcome email | After the subscriber confirms their email via the confirmation link |
Customizing email templates
Email templates are defined as inline HTML strings in src/lib/resend.ts. Edit the sendWelcomeEmail and sendSubscriptionConfirmationEmail functions to customize the design, copy, and branding of your emails.