# React Email — Build and Send Emails Using React > React Email lets developers create beautiful HTML emails with React components, preview in browser, and send via Resend, Nodemailer, or any ESP. ## Install Save as a script file and run: ## Quick Use ```bash npx create-email@latest cd react-email-starter npm run dev ``` Open `http://localhost:3000` — preview and edit email templates with hot reload. ## Intro **React Email** is a collection of high-quality, unstyled components for building HTML emails using React and TypeScript. Created by the Resend team, it solves the notorious pain of email HTML compatibility by providing components that render correctly across all major email clients. With 18.4K+ GitHub stars and MIT license, React Email replaces messy HTML table layouts with clean JSX components, complete with a local preview server and integration with any email sending provider. ## What React Email Does React Email transforms email development from HTML tables into modern React: - **React Components**: ``, ``, ``, ``, `
`, ``, ``, ``, ``, ``, ` ); } ``` ### Sending with Resend ```typescript import { Resend } from "resend"; import WelcomeEmail from "./emails/welcome"; const resend = new Resend("re_123456"); await resend.emails.send({ from: "hello@example.com", to: "user@example.com", subject: "Welcome!", react: WelcomeEmail({ name: "Alice" }), }); ``` ### Sending with Nodemailer ```typescript import { render } from "@react-email/render"; import nodemailer from "nodemailer"; import WelcomeEmail from "./emails/welcome"; const html = await render(WelcomeEmail({ name: "Alice" })); const transporter = nodemailer.createTransport({ /* SMTP config */ }); await transporter.sendMail({ from: "hello@example.com", to: "user@example.com", subject: "Welcome!", html, }); ``` ## FAQ **Q: Does React Email work with all email clients?** A: Yes. Components render to compatible HTML that works across Gmail, Outlook, Apple Mail, Yahoo, and mobile clients. **Q: Can I use Tailwind CSS?** A: Yes. Install `@react-email/tailwind` and wrap your email in a `` component to use Tailwind utility classes. **Q: Is React Email only for Resend?** A: No. While built by the Resend team, React Email works with any email provider. Use `render()` to get HTML, then send via any ESP or SMTP. **Q: Can I preview emails before sending?** A: Yes. Run `npm run dev` for a local preview server with hot reload at `localhost:3000`. ## Source & Thanks - GitHub: [resend/react-email](https://github.com/resend/react-email) — 18.4K+ ⭐ | MIT - Website: [react.email](https://react.email) - Docs: [react.email/docs](https://react.email/docs) ## 快速使用 ```bash npx create-email@latest cd react-email-starter npm run dev ``` 打开 `http://localhost:3000`,实时预览和编辑邮件模板。 ## 简介 **React Email** 是一组高质量的 React 组件库,用于构建 HTML 邮件。由 Resend 团队创建,解决了邮件 HTML 兼容性的痛点,提供在所有主流邮件客户端中正确渲染的组件。 拥有 18.4K+ GitHub 星标和 MIT 许可证,React Email 用简洁的 JSX 组件替代混乱的 HTML 表格布局,配备本地预览服务器,支持集成任何邮件发送服务。 ## 核心功能 - **React 组件**:提供 Html、Body、Container、Text、Button 等邮件专用组件 - **样式支持**:内联样式或 Tailwind CSS - **预览服务器**:本地开发服务器,支持热重载 - **渲染为 HTML**:将 React 组件转换为邮件兼容的 HTML 字符串 - **ESP 集成**:支持 Resend、Nodemailer、SendGrid、Postmark、AWS SES ## 常见问题 **Q: React Email 兼容所有邮件客户端吗?** A: 是的。组件渲染为兼容的 HTML,支持 Gmail、Outlook、Apple Mail、Yahoo 和移动端。 **Q: 只能配合 Resend 使用吗?** A: 不是。虽然由 Resend 团队构建,但 React Email 可配合任何邮件服务使用。 ## 来源与致谢 - GitHub: [resend/react-email](https://github.com/resend/react-email) — 18.4K+ ⭐ | MIT - 官网: [react.email](https://react.email) --- Source: https://tokrepo.com/en/workflows/f9027a32-3474-11f1-9bc6-00163e2b0d79 Author: Script Depot