Learn how to send your first email using Hono and the Resend Node.js SDK.
npm install resend
emails/email-template.tsx
import * as React from 'react'; interface EmailTemplateProps { firstName: string; } export function EmailTemplate({ firstName }: EmailTemplateProps) { return ( <div> <h1>Welcome, {firstName}!</h1> </div> ); }
tsconfig.json
{ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "react" } }
index.tsx
import { Hono } from 'hono'; import { Resend } from 'resend'; import { EmailTemplate } from './emails/email-template'; const app = new Hono(); const resend = new Resend('re_xxxxxxxxx'); app.get('/', async (c) => { const { data, error } = await resend.emails.send({ from: 'Acme <onboarding@resend.dev>', to: ['delivered@resend.dev'], subject: 'hello world', react: <EmailTemplate firstName="John" />, }); if (error) { return c.json(error, 400); } return c.json(data); }); export default app;
Was this page helpful?