A guide on how to use Unsend with React Email
npm install unsend @react-email/render
import * as React from "react"; import { Html } from "@react-email/html"; import { Button } from "@react-email/button"; export function Email(props) { const { url } = props; return ( <Html lang="en"> <Button href={url}>Click me</Button> </Html> ); }
import { Unsend } from "unsend"; import { render } from "@react-email/render"; import { Email } from "./email"; const unsend = new Unsend("us_your_unsend_api_key"); const html = await render(<Email url="https://unsend.dev" />); const response = await unsend.emails.send({ to: "[email protected]", from: "[email protected]", subject: "Unsend email", html, });
email.jsx
{ "plugins": ["@babel/plugin-proposal-class-properties"] }
jsx
tsconfig.json
{ "compilerOptions": { "jsx": "react-jsx" } }