Pass a component, not a string
The Node SDK accepts a react field. It renders the element with @react-email/render and sends the resulting HTML — the JSX never travels over the wire, and eusend never executes your code.
import { Eusend } from '@eusend_dev/sdk'
import { OrderConfirmation } from './emails/order-confirmation'
const client = new Eusend(process.env.EUSEND_API_KEY)
await client.emails.send({
from: '[email protected]',
to: order.customerEmail,
subject: 'Your order is confirmed',
react: <OrderConfirmation order={order} />,
})That means templates live in your repository, next to the code that sends them. They are reviewed in pull requests, typechecked against the data you pass in, and versioned with the release that introduced them. A wrong prop name is a build error rather than an email that says Hi undefined.
Or store the template with us
Sometimes the person editing the copy isn’t the person deploying the app. Stored templates hold rendered HTML on eusend and personalize it at send time through {{variable}} placeholders, so the send call carries data instead of markup.
await client.emails.send({
from: '[email protected]',
to: '[email protected]',
subject: 'Your order is confirmed',
templateId: 'tpl_order_confirmation',
variables: { name: 'Alice', orderId: '1043' },
})Templates can be written in the dashboard’s live-preview editor or created over the API — including by rendering a React Email component locally and submitting the output. The two approaches are the same pipeline from opposite ends.
What the renderer handles for you
- Layout that survives. Components compile to the table-based structure email clients actually agree on, so a two-column layout doesn’t collapse in Outlook.
- Inlined styles. Styles are inlined where clients strip
<style>blocks, which is most of them. - A plain-text alternative. Supply
textalongside the HTML — a multipart message reads better in text-only clients and looks less like spam to filters.
Tracking is applied after rendering
Open pixels and click-tracking rewrites happen server-side, on the finished HTML, and only when tracking is enabled for that send. Your component doesn’t need to know they exist — and every tracking request that results is served from EU infrastructure.
Install the Node SDK, point the react field at a component, and send with a test key until it looks right in every client you care about.
Create a free account