Perfect for: Professional-looking transactional emails with consistent branding and multi-language support.
Template Overview
All email templates are located insrc/lib/emails/ and follow a consistent structure:
src/lib/emails/
├── email-change-email-verification.tsx
├── internal-email.tsx
├── invitation-organization-link-email.tsx
├── magic-link-email.tsx
├── notification-email.tsx
├── otp-email.tsx
├── reset-password-email.tsx
├── subscription-canceled-email.tsx
├── subscription-completed-email.tsx
├── subscription-deleted-email.tsx
├── subscription-updated-email.tsx
├── verification-email.tsx
└── welcome-follow-up-email.tsx
Template Categories
Authentication-related templates:
magic-link-email.tsx- Passwordless authentication linksverification-email.tsx- Email address verificationreset-password-email.tsx- Password reset linksotp-email.tsx- Two-factor authentication codesemail-change-email-verification.tsx- Email change confirmation
Template Structure
Here's the structure of a typical template usingmagic-link-email.tsx as an example:
// From src/lib/emails/magic-link-email.tsx
import {
Body,
Container,
Head,
Html,
Link,
Preview,
Section,
Tailwind,
Text,
} from '@react-email/components'
import { getTranslations } from 'next-intl/server'
import { Fragment } from 'react'
type MagicLinkMailProps = {
url: string
}
export default async function MagicLinkMail({ url }: MagicLinkMailProps) {
// Server-side translations with next-intl
const t = await getTranslations('email.user.verify')
return (
<Html>
<Head />
<Tailwind>
<Fragment>
<Preview>{t('preview')}</Preview>
<Body className="mx-auto my-auto bg-white px-2 font-sans">
<Container className="mx-auto my-[40px] max-w-[465px] rounded border border-solid border-[#eaeaea] p-8">
<Text className="text-2xl font-bold text-black">
{t('title')}
</Text>
<Section className="my-4">
<Text className="text-base">
<Link
className="text-sky-500 hover:cursor-pointer hover:underline"
href={url}
>
{t('clickToConnect')}
</Link>
</Text>
<Text className="text-base text-gray-500">
{t('ignoreMessage')}
</Text>
</Section>
{/* More content... */}
</Container>
</Body>
</Fragment>
</Tailwind>
</Html>
)
}Key Features
🎨 Tailwind CSS Styling
All templates use Tailwind CSS for consistent styling:// Responsive container
<Container className="mx-auto my-[40px] max-w-[465px] rounded border border-solid border-[#eaeaea] p-8">
// Typography classes
<Text className="text-2xl font-bold text-black">
// Interactive elements
<Link className="text-sky-500 hover:cursor-pointer hover:underline">🌍 Multi-language Support
Templates automatically load translations using next-intl:// Server-side translation loading
const t = await getTranslations('email.user.verify')
// Usage in template
<Text className="text-2xl font-bold text-black">
{t('title')}
</Text>📱 Responsive Design
Templates are designed to work across all email clients:- Maximum width containers for desktop
- Responsive padding and margins
- Email-safe CSS properties
- Tested across major email clients
Template Props
Each template accepts specific props based on its purpose:// Magic Link
type MagicLinkMailProps = {
url: string
}
// OTP Email
type OtpEmailProps = {
otp: string
otpLink?: string
}
// Verification/Reset
type VerificationMailProps = {
url: string
}Preview Props
Each template includes preview props for development:// From magic-link-email.tsx
MagicLinkMail.PreviewProps = {
url: 'test 2',
} as MagicLinkMailPropsTemplate Integration
Templates are automatically integrated with the email service:// From src/services/email-service.ts
export const sendMagicLinkEmailService = async ({
email,
url,
}: {
email: string
url: string
}) => {
const t = await getTranslations('email.user.magicLink')
await sendEmailService({
to: email,
subject: t('subject'),
from: fromEmail,
text: t('preview'),
react: MagicLinkMail({ url }), // Template integration
})
}Best Practices
1
Consistent Styling
Use the established Tailwind classes for consistency across templates
2
Translation Keys
Follow the existing translation namespace pattern:
email.user.templateName3
Preview Text
Always include a meaningful preview text for email clients
4
Responsive Design
Test templates across different email clients and screen sizes
Professional templates ready! Your application has beautiful, responsive email templates with multi-language support and consistent branding.