How to send email with Resend and EmailTemplate
EmailTemplate renders the HTML; Resend delivers it. The resend export adapter produces a ready-to-use React Email component, and the Resend API accepts that same HTML. This guide covers the full flow: render in EmailTemplate, send with the Resend SDK, and the curl variant.
How do I send a rendered email with Resend?
-
Prepare both API keys
You need an EmailTemplate key (to render) and a Resend key (to send). Each one in its own environment variable.
bash# .env.local EMAIL_TEMPLATE_API_KEY=et_your_key EMAIL_TEMPLATE_API_URL=https://api.emailtemplate.theboomer.dev/api/v1 RESEND_API_KEY=re_your_key -
Render in EmailTemplate
The render returns the HTML and subject with variables already substituted. That HTML is what Resend sends.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates/64f8a1b2c3d4e5f6a7b8c9d1/render \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "variables": { "user.name": "Ana", "order.id": "A-1024" } }' -
Send with the Resend SDK
The Resend SDK accepts html directly. Pass the subject returned by EmailTemplate so the subject and preheader stay consistent.
ts// src/send-order.ts import { Resend } from 'resend' import { renderTemplate } from './lib/email-template' const resend = new Resend(process.env.RESEND_API_KEY) export async function sendOrder(email: string, userName: string, orderId: string) { const { html, subject } = await renderTemplate( process.env.ORDER_TEMPLATE_ID as string, { 'user.name': userName, 'order.id': orderId } ) const { data, error } = await resend.emails.send({ from: 'Acme <[email protected]>', to: [email], subject, html }) if (error) throw new Error(error.message) return data?.id } -
Export the resend adapter (JSX)
If you prefer local authoring with React Email, the resend adapter returns a JSX component with typed props derived from the variables.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates/64f8a1b2c3d4e5f6a7b8c9d1/export \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "format": "resend" }' # Response: { "format": "resend", "name": "...", "mimeType": "text/javascript", # "content": "import { Html, Head, ... } from '@react-email/components'; ..." } -
Send with curl
For a quick test or a shell script, the Resend API also accepts the HTML directly.
bashcurl -s -X POST https://api.resend.com/emails \ -H "Authorization: Bearer $RESEND_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "Acme <[email protected]>", "to": ["[email protected]"], "subject": "Your order A-1024 is on its way", "html": "<h1>Hi Ana</h1><p>Order A-1024</p>" }' -
Resend delivery webhooks
Resend can notify deliveries, opens and bounces. Configure the webhook in the Resend dashboard and register the endpoint in your ERP.
bash# Configure this endpoint in Resend, for example: POST https://erp.example.com/resend/webhook Events: email.sent, email.delivered, email.opened, email.bounced
| Item | Free | Pro | Team | Enterprise |
|---|---|---|---|---|
| Monthly price (EUR, VAT excluded) | €0 | €19 | €59 | €149 |
| Renders per month | 500 | 25,000 | 100,000 | 500,000 |
| Concurrent templates | 3 | 25 | Unlimited | Unlimited |
| Users | 1 | 2 | 10 | 25 |
| AI credits per month | 50 | 500 | 2,000 | 10,000 |
| AI operation cost | generate: 10 credits · suggest: 5 credits. Charged to the credit wallet (they do not consume renders) and the same on every plan. Packs: 500 credits / €9, 2,000 / €29, 5,000 / €69, 10,000 / €119. | |||
| Stack provider export | format=resend returns the React Email component as JSX (text/javascript); the rendered HTML is sent as-is through the Resend SDK or curl. | |||
Subscription prices in USD/month; credit packs are charged in EUR. Product-published data, not estimates.
Frequently asked questions
Does EmailTemplate send through Resend automatically?
No. EmailTemplate renders and exports; Resend delivers. The resend adapter gives you JSX or HTML ready for the Resend API.
Do I need a verified domain in Resend?
Yes. Verify the domain (or use the test sender) before sending to real customers.
React Email or direct HTML?
It depends on the team. React Email gives component authoring; the direct HTML from the render is simpler and works the same in Resend.