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
- Pick and export one provider from
src/lib/email/index.ts. - Build a React email template from
src/shared/emails. - Call
sendEmailfrom your server-side flow.
import { sendEmail } from '@/lib/email';Available providers
Plunk
Use Plunk API with PLUNK_SECRET_KEY for transactional email delivery.
Resend
Use Resend API with RESEND_API_KEY to send transactional emails.
Nodemailer
Use SMTP credentials and Nodemailer for direct email delivery.
Set the "from" email address
Set sender configuration in 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:devThis uses ./src/shared/emails as the preview directory.
Add a new template
- Create a new file in
src/shared/emails, for exampleinvoice-paid.tsx. - Export a typed component that returns React Email markup.
- Pass the rendered component into
sendEmailfrom 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,
}),
});