What is React Email?
React Email allows you to write email templates using familiar React components instead of traditional HTML table layouts. This approach offers:- Component-based architecture: Reuse components across different email templates
- Type safety: Leverage TypeScript for better development experience
- Modern development: Use the tools and patterns you already know from web development
Core components
React Email provides essential components for building emails. Here are the most commonly used ones:Essential components
Html
Html
The root component that wraps your entire email. Always use this as the outermost component.
Head
Head
Contains meta information for your email. Include this near the top of your template.
Preview
Preview
The preview text that appears in email clients before opening the email. Keep it concise and compelling.
Body
Body
The main body of your email. Apply global styles here.
Container
Container
A centered container for your email content. Recommended max width is 600px for optimal email client support.
Section
Section
Groups related content together. Similar to a
<div> in HTML.Text
Text
For paragraphs and text content. Use this instead of
<p> tags.Button
Button
Link
Link
For inline text links.
Img
Img
For images. Always include
alt text and specify dimensions.Email client compatibility
Email clients have varying levels of support for modern HTML and CSS. Understanding these limitations is crucial for creating emails that work everywhere.Support levels
Modern clients (good support)
- Apple Mail (macOS, iOS)
- Gmail (web, mobile apps)
- Outlook (web, macOS)
- Hey, Superhuman
Limited support clients
- Outlook 2016-2021 (Windows)
- Yahoo Mail
- AOL Mail
Best practices for compatibility
- Use React Email components: These handle cross-client compatibility automatically
- Test in multiple clients: Use tools like Email on Acid or Litmus
- Avoid complex CSS: Stick to simple layouts and styles
- Use inline styles: The
Tailwindcomponent handles this conversion - Specify image dimensions: Always include
widthandheightattributes
Common patterns
Two-column layout
Horizontal rule
Conditional rendering
React Email templates are just React components, so you can use props, conditional rendering, and loops just like regular React components.
Next steps
Tailwind styling
Learn how to style your emails with Tailwind CSS
Customization
Customize templates with your brand colors and fonts
Sending emails
Render and send your email templates