Learn how to send your first email using Vercel Functions.
app/api/send/route.ts
const RESEND_API_KEY = 're_xxxxxxxxx'; export async function POST() { const res = await fetch('https://api.resend.com/emails', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${RESEND_API_KEY}`, }, body: JSON.stringify({ from: 'Acme <onboarding@resend.dev>', to: ['delivered@resend.dev'], subject: 'hello world', html: '<strong>it works!</strong>', }), }); if (res.ok) { const data = await res.json(); return Response.json(data); } }
npx next dev
http://localhost:3000/api/send
vercel
https://your-project.vercel.app/api/send
Was this page helpful?