SecureStartKit

Emails

Transactional emails with React Email and Resend.

Overview

Email templates are built with React Email and sent via Resend. Three templates are included: welcome, email verification, and password reset.

Setup

  1. Sign up at resend.com
  2. Add your API key to .env.local as RESEND_API_KEY
  3. Verify your domain in Resend
  4. Update the from address in config.ts:
email: {
  from: 'YourSaaS <noreply@yoursaas.com>',
  supportEmail: 'support@yoursaas.com',
}

Sending Emails

import { sendWelcomeEmail } from '@/lib/resend/send'

await sendWelcomeEmail({
  email: 'user@example.com',
  name: 'John',
})

Templates

Templates live in the emails/ directory:

TemplateFileTrigger
Welcomeemails/welcome.tsxAfter signup
Verify Emailemails/verify-email.tsxEmail confirmation
Reset Passwordemails/reset-password.tsxPassword reset request

Creating New Templates

  1. Create a new file in emails/:
import { Html, Head, Body, Text } from '@react-email/components'

export default function MyEmail({ name }: { name: string }) {
  return (
    <Html>
      <Head />
      <Body>
        <Text>Hello {name}!</Text>
      </Body>
    </Html>
  )
}
  1. Add a send function in lib/resend/send.ts

Previewing Templates

Use the React Email dev server to preview your templates locally:

npx email dev