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:

  1. Email address is validated and submitted to /api/subscribers
  2. A new Subscriber record is created in Postgres with status PENDING
  3. A tokenized confirmation email is sent via Resend (sendSubscriptionConfirmationEmail)
  4. When the subscriber clicks the confirmation link (/api/subscribers/confirm?token=...), their status updates to ACTIVE
  5. A welcome email is sent (sendWelcomeEmail)
  6. If RESEND_AUDIENCE_ID is set, the contact is synced to Resend Audiences

Transactional emails

BloggFast sends the following transactional emails (all defined in src/lib/resend.ts):

EmailTrigger
Subscription confirmationImmediately when a user submits the subscription form
Welcome emailAfter 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.