Use this pre-built prompt to get started faster.
Prerequisites
Before you start, you’ll need:- A Resend API key
- A verified domain
Guide
1
Install dependencies
Install the Resend Node.js SDK:
2
Set up environment variables
Add your Resend API key to your environment variables:
.env.local
3
Create a Next.js function
Create a route file under
app/api/send/route.ts if you’re using the App Router.route.ts
4
Send email locally
Run function locally:Open the endpoint URL to send an email:
http://localhost:3000/api/send5
Send email in production
Deploy function to Vercel:Make sure to add your
RESEND_API_KEY environment variable in your Vercel project settings.Open the endpoint URL to send an email: https://your-project.vercel.app/api/sendExamples
Vercel Functions Example
See the full source code.