Skip to content
Engineering

Email Templates with React Email 6: Components, Rendering and Sending via Resend or Postmark

AIDToolStack EditorialNovember 7, 20267 min read
reactemailreact emailresendpostmark
Share:Twitter

HTML email is stuck in roughly 2005: tables for layout, inline styles, and comments that only Outlook reads. React Email doesn't change any of that. What it changes is who writes it. You write components with props and types, and the library emits the table soup for you.

Here's the current setup as of November 2026, a real template rendered locally, and how to hand the output to Resend or Postmark without the usual surprises.

What changed in versions 5 and 6

If you set React Email up a year ago, your imports are probably out of date. From the changelog:

  • 6.0 (16 April 2026) moved the components and render utilities into the single react-email package, saying @react-email/components and the per-component packages are "no longer needed." The preview server was renamed to @react-email/ui. On npm, @react-email/components 1.0.12 is now marked "Package no longer supported."
  • 5.0 (7 November 2025) moved the Tailwind component to Tailwind v4 and added a dark mode switcher to the preview that simulates how clients invert colours.

The upgrade guide boils down to: remove @react-email/components and @react-email/preview-server, install react-email and @react-email/ui, and change imports to from "react-email". The latest release is react-email 6.11.8, published on 6 November 2026 (releases), and npm lists its engine requirement as Node 20.19.0 or later.

Setup, per the manual setup docs:

npm install react-email react react-dom -E
npm install @react-email/ui -D -E

Add "email:dev": "email dev" to your scripts, put templates in emails/, and the preview runs on localhost:3000.

A template that renders

This is a password reset email. It typechecks under TypeScript 7 in strict mode, and I rendered it with react-email 6.11.8 on Node.

// emails/password-reset.tsx
import { Body, Button, Container, Head, Heading, Html, Preview, Section, Text } from "react-email";

type Props = { name: string; resetUrl: string; expiresInMinutes: number };

export default function PasswordReset({ name, resetUrl, expiresInMinutes }: Props) {
  return (
    <Html lang="en">
      <Head />
      <Preview>{`Reset your password (link expires in ${expiresInMinutes} minutes)`}</Preview>
      <Body style={{ backgroundColor: "#f6f7f9", fontFamily: "Arial, sans-serif" }}>
        <Container style={{ maxWidth: 560, padding: 24, backgroundColor: "#ffffff" }}>
          <Heading as="h1" style={{ fontSize: 22 }}>Reset your password</Heading>
          <Text>Hi {name}, someone asked to reset the password for your account.</Text>
          <Section style={{ textAlign: "center", margin: "24px 0" }}>
            <Button href={resetUrl} style={{ backgroundColor: "#2563eb", color: "#fff", padding: "12px 20px", borderRadius: 6 }}>
              Choose a new password
            </Button>
          </Section>
          <Text>If you didn't ask for this, ignore this email. The link expires in {expiresInMinutes} minutes.</Text>
          <Text data-skip-in-text="true" style={{ color: "#6b7280", fontSize: 12 }}>Sent by Example Inc.</Text>
        </Container>
      </Body>
    </Html>
  );
}

PasswordReset.PreviewProps = {
  name: "Sam", resetUrl: "https://example.com/reset?t=abc", expiresInMinutes: 30,
} satisfies Props;

PreviewProps is how the preview server gets sample data; the docs' React Intl guide sets it the same way. I built the Preview text as one template string so it renders as a single text node.

What came out is worth looking at, because it explains why you don't want to write this by hand. The rendered HTML was 4,596 bytes for those few lines. Body became a full-width <table role="presentation"> with the font moved onto its <td>, Container became a centred table, and Preview became a hidden div padded with invisible characters so the inbox snippet doesn't pick up the email body. The Button came out as an <a> with Outlook-only padding hacks inside conditional comments:

<span><!--[if mso]><i style="mso-font-width:500%;mso-text-raise:18px" hidden>&#8202;&#8202;</i><![endif]--></span>

Remember that line. It matters in the gotchas below.

Pipeline: a React template is rendered by react-email into HTML and plain text, previewed with email dev, then sent through Resend or Postmark
Pipeline: a React template is rendered by react-email into HTML and plain text, previewed with email dev, then sent through Resend or Postmark

Rendering HTML and plain text

The render docs show three helpers, all imported from react-email:

import { render, pretty, toPlainText } from "react-email";

const html = await render(<PasswordReset name="Sam" resetUrl={url} expiresInMinutes={30} />);
const readable = await pretty(html); // indented, for debugging or snapshots
const text = toPlainText(html);

render is async, so forgetting the await hands your email provider a Promise. The plain-text output for my template was:

RESET YOUR PASSWORD

Hi Sam, someone asked to reset the password for your account.

Choose a new password https://example.com/reset?t=abc

If you didn't ask for this, ignore this email. The link expires in 30 minutes.

The footer marked data-skip-in-text="true" was left out of the text version and kept in the HTML, as documented. render(element, { plainText: true }) produced the same text.

Send both parts. Recipients who can't or won't view HTML get something readable, and our deliverability guide covers the authentication records that matter more for the inbox than the markup does.

Sending with Resend

Resend's Node SDK takes the component directly through the react parameter, which the send email API reference marks "Only available in the Node.js SDK." Its Node guide passes the component as a function call rather than JSX, which also works from a plain .ts file:

import { Resend } from "resend";
import PasswordReset from "./emails/password-reset";

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send(
  {
    from: "Example <[email protected]>",
    to: [user.email],
    subject: "Reset your password",
    react: PasswordReset({ name: user.name, resetUrl, expiresInMinutes: 30 }),
  },
  { idempotencyKey: `password-reset/${resetRequest.id}` },
);
if (error) throw new Error(`${error.name}: ${error.message}`);

A few details from Resend's docs and SDK:

  • The SDK returns { data, error } rather than throwing, so check error yourself.
  • If you omit text, Resend generates a plain-text version from the HTML. Pass an empty string to opt out.
  • Idempotency keys expire after 24 hours and can be up to 256 characters. A key like password-reset/<id> stops a retried job from sending the same reset twice.
  • to accepts up to 50 addresses.
  • In SDK version 6.37.0 the react option works by dynamically importing @react-email/render and throws "Failed to render React component" if it can't. react-email 6 depends on that package, so a normal install has it; if you hit the error in a pruned deployment, render to html yourself instead.
  • If you use Resend's hosted templates (the template field), you can't also send html, text or react.

Sending with Postmark

Postmark doesn't know about React, so render first and pass strings. The React Email Postmark guide does exactly that with the postmark package (5.1.0 on npm as of November 2026):

import { ServerClient } from "postmark";
import { render, toPlainText } from "react-email";

const client = new ServerClient(process.env.POSTMARK_SERVER_TOKEN!);
const html = await render(PasswordReset({ name: user.name, resetUrl, expiresInMinutes: 30 }));

await client.sendEmail({
  From: "[email protected]",
  To: user.email,
  Subject: "Reset your password",
  HtmlBody: html,
  TextBody: toPlainText(html),
  MessageStream: "outbound",
});

From the Postmark email API docs: the From address needs a confirmed sender signature, one of HtmlBody or TextBody is required (the page doesn't promise to generate text for you, so send both), MessageStream defaults to the transactional outbound stream, and a message can have at most 50 recipients across To, Cc and Bcc. The batch endpoint takes up to 500 messages and 50 MB per call, and returns a 200 even when some messages fail, so check each result's ErrorCode.

Both snippets are the shape I typechecked locally; I didn't send real mail.

Gotchas

  • Comment-stripping breaks Outlook. A minifier or sanitiser that removes every HTML comment also removes the <!--[if mso]> blocks React Email's Button relies on. I ran a simple regex minifier over my rendered email and both conditional comments were gone. If something in your pipeline post-processes the HTML, check it keeps conditional comments, or skip it: the rendered output is already compact.
  • Porting old templates. Our HTML to JSX converter handles the mechanical part of turning an existing email into a component (class to className, inline style strings to objects, self-closing void tags). It converts HTML comments into JSX comments, though, which never render, so any Outlook conditional comments in the original are dropped (the tool warns you when it finds them). Rebuild those parts with React Email's components rather than copying them across.
  • email export ignores PreviewProps. The CLI's export command is documented as a secondary option to render (CLI docs). When I ran email export --plainText on the template above, the output read "Hi , someone asked..." and "expires in minutes": it rendered without any props. Give components safe defaults, or render in code with real data.
  • Sending from an assistant. Both providers have official MCP servers, Resend's and Postmark's, handy for sending test versions of a template while you build it. For Postmark, use the scoped @activecampaign/postmark-mcp package: in September 2025 an unrelated npm package named postmark-mcp added a hidden BCC of every outgoing email to an attacker's address from version 1.0.16 onward, per Qualys's write-up. Our email MCP roundup compares the options.

A short checklist for each new template

  1. Imports come from react-email, not @react-email/components.
  2. Props are typed, and PreviewProps holds realistic sample data.
  3. Preview text is set and reads well on its own.
  4. You await render() and send both HTML and a plain-text part.
  5. Nothing strips comments from the output before it's sent.
  6. Retries use an idempotency key (Resend) or your own dedupe (Postmark).
  7. You've opened the preview's dark mode switcher and checked the email still reads in an inverted inbox.
AE

Written by AIDToolStack Editorial

Researched from official documentation, specifications and vendor pages, listed under Sources below. Last checked November 2026.

Sources

  1. react.email/docs/changelog
  2. react.email/docs/getting-started/updating-react-email
  3. react.email/docs/getting-started/manual-setup
  4. react.email/docs/utilities/render
  5. react.email/docs/cli
  6. react.email/docs/guides/internationalization/react-intl
  7. react.email/docs/integrations/postmark
  8. github.com/resend/react-email/releases
  9. www.npmjs.com/package/react-email
  10. www.npmjs.com/package/@react-email/components
  11. resend.com/docs/send-with-nodejs
  12. resend.com/docs/api-reference/emails/send-email
  13. postmarkapp.com/developer/api/email-api
  14. github.com/ActiveCampaign/postmark.js
  15. threatprotect.qualys.com/2025/09/30/malicious-mcp-server-on-npm-postmark-mcp-exploited-in-attack/

Related Posts

Explore on AIDToolStack

Discover tools and servers featured in our directory.

MCP Servers

Trigger.dev Jobs MCP ServerManage Trigger.dev background jobs from your AI coding assistant. Monitor job runs, trigger tasks manually, inspect execution logs, manage schedules, and debug failed runs. The server provides operational visibility into your background job infrastructure — see which tasks are running, queued, or failed, and take action. Your AI can help diagnose job failures from execution logs, retry failed tasks, and optimize concurrency configurations for better throughput.Tailscale Network MCP ServerManage your Tailscale mesh VPN network from your AI coding assistant. View connected devices, manage ACLs, configure exit nodes, check device status, and manage DNS settings. The server provides visibility into your Tailscale network — see which machines are online, troubleshoot connectivity issues, manage network access policies, and configure routes. Useful for developers managing distributed infrastructure where Tailscale provides secure networking between services.Portainer Docker MCP ServerManage Docker environments through Portainer's API from your AI coding assistant. Control containers, images, networks, and volumes across multiple Docker hosts and Kubernetes clusters. The server provides tools for container lifecycle management, image pulling and building, stack deployment, and resource monitoring. Portainer's multi-environment management makes this server particularly valuable for teams managing containers across development, staging, and production environments.

Reviews

Sign in to leave a review.

No reviews yet. Be the first!

Comments

Sign in to leave a comment.

No comments yet. Be the first!

Sponsor Our Newsletter

Reach thousands of developers who are actively evaluating AI tools, MCP servers, and dev infrastructure. Our weekly newsletter goes to engaged technical decision-makers.

Growing subscriber baseHigh open rates

All sponsored content is clearly labeled per our editorial policy.