Skip to main content

Use this pre-built prompt to get started faster.

Open in Cursor

Prerequisites

Before you start, you’ll need: Make sure you have the latest version of the Vercel CLI installed.

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/send
5

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/send

Examples

Vercel Functions Example

See the full source code.