apps/docs/integrations/resend.mdx
<Tip>Resend was built by the same team that created React Email, which makes this our recommendation to send emails.</Tip>
Get the @react-email/components package and the Resend Node.js SDK.
<CodeGroup>npm install resend @react-email/components
yarn add resend @react-email/components
pnpm add resend @react-email/components
Start by building your email template in a .jsx or .tsx file.
import * as React from 'react';
import { Html, Button } from "@react-email/components";
export function Email(props) {
const { url } = props;
return (
<Html lang="en">
<Button href={url}>Click me</Button>
</Html>
);
}
export default Email;
<Info>When integrating with other services, you need to convert your React template into HTML before sending. Resend takes care of that for you.</Info>
Import the email template you just built and use the Resend SDK to send it.
import { Resend } from 'resend';
import { Email } from './email';
const resend = new Resend('re_123456789');
await resend.emails.send({
from: '[email protected]',
to: '[email protected]',
subject: 'hello world',
react: <Email url="https://example.com" />,
});
Resend Templates are a great way to collaborate on emails with your team, even if they're not technical. Upload a React Email Template to Resend and your entire team can collaborate in real-time in the visual editor.
Here's how to get started.
First, sign up for a free Resend account.
Next, set up the Resend integration using the React Email CLI:
npx react-email@latest resend setup
This will prompt you to enter your Resend API Key. To get one, navigate to API Keys in your Resend dashboard, click Create API key, and ensure that the API Key is scoped to Full Access.
Paste the API Key into the terminal and press enter.
Run React Email and visit the Resend tab of the toolbar, located at the bottom of the window.
Choose Upload or Bulk Upload to import your Template to Resend.
<video src="https://cdn.resend.com/posts/react-email-resend-integration.mp4" autoPlay loop playsInline class="extraWidth"></video>
If you want to remove the Resend integration, run npx react-email@latest resend reset.
<Card title="Resend example" icon='arrow-up-right-from-square' iconType="duotone" href="https://github.com/resend/react-email/tree/main/examples/resend"
See the full source code. </Card>