Learn how to send an email using React Email and the Postmark Node.js SDK.
npm install postmark @react-email/components
.jsx
.tsx
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> ); }
import { render } from '@react-email/components'; import postmark from 'postmark'; import { Email } from './email'; const client = new postmark.ServerClient(process.env.POSTMARK_API_KEY); const emailHtml = await render(<Email url="https://example.com" />); const options = { From: 'you@example.com', To: 'user@gmail.com', Subject: 'hello world', HtmlBody: emailHtml, }; await client.sendEmail(options);