Documentation
Sending Emails

Overview

Learn how email sending is structured in GoLiveKit and how to add templates and providers.

AI Skill for emails

Prompt: Type /emails in your Copilot / Cursor or other chat to use skill with the provided context.
/emails Implement email sending for [describe action/event].

GoLiveKit uses provider-specific email senders under src/lib/email/providers.

Sending logic

  1. Pick and export one provider from src/lib/email/index.ts.
  2. Build a React email template from src/shared/emails.
  3. Call sendEmail from your server-side flow.
import { sendEmail } from '@/lib/email';

Available providers

Set the "from" email address

Set sender configuration in src/config/app.ts:

src/config/app.ts
emails: {
  from: '[email protected]',
  fromName: 'Your Product Team',
},

The value is read from APP_CONFIG.emails.from and used by providers as sender identity.

Mail templates

Folder where templates are stored

Email templates are stored in src/shared/emails.

Preview templates

Run the React Email preview server:

pnpm email:dev

This uses ./src/shared/emails as the preview directory.

Add a new template

  1. Create a new file in src/shared/emails, for example invoice-paid.tsx.
  2. Export a typed component that returns React Email markup.
  3. Pass the rendered component into sendEmail from your server logic.

Send a template

Import template

import { SubscriptionSuccessEmail } from '@/shared/emails/subscription-success';

Call sendEmail

await sendEmail({
  to: user.email,
  subject: 'Your subscription is now active',
  component: SubscriptionSuccessEmail({
    name: user.name,
    planName: plan?.name ?? 'Subscription plan',
    amountText: formatAmount(
      session.amount_total ?? configuredPrice?.amount ?? 0,
      session.currency ?? configuredPrice?.currency ?? 'usd',
    ),
    dashboardLink: LINKS.dashboard.billingsSubscription,
  }),
});

On this page