Prompt

How do I send emails from a Vercel app?

Technology / Api platforms7 observationsLast seen Nov 24, 2026

Latest observation

Nov 24, 2026OpenAI APIWeb search: off

You have a few solid options for sending email from a Vercel app. The most common approach is:

  1. Use a server-side API route or server action
  2. Call an email provider’s API
  3. Never send email directly from client-side code

Recommended approach

1) Pick an email service

Common choices:

  • Resend — very popular for modern apps and easy with Vercel
  • SendGrid
  • Postmark
  • Mailgun
  • Amazon SES

If you want the simplest setup, Resend is a great default.


Example: sending email with Resend in a Next.js app on Vercel

Install

npm install resend

Add your API key to Vercel environment variables

In Vercel dashboard:

  • Project → Settings → Environment Variables
  • Add:
    • RESEND_API_KEY=...

For local development, put it in .env.local.

Create an API route

If you're using Next.js App Router:

// app/api/send-email/route.ts
import { NextResponse } from "next/server";
import { Resend } from "resend";

const resend = new Resend(process.env.RESEND_API_KEY!);

export async function POST(req: Request) {
  const { to, subject, text } = await req.json();

  try {
    const data = await resend.emails.send({
      from: "Your App <noreply@yourdomain.com>",
      to,
      subject,
      text,
    });

    return NextResponse.json({ success: true, data });
  } catch (error) {
    return NextResponse.json(
      { success: false, error: "Failed to send email" },
      { status: 500 }
    );
  }
}

Call it from the client

await fetch("/api/send-email", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    to: "user@example.com",
    subject: "Welcome!",
    text: "Thanks for signing up.",
  }),
});

Important Vercel notes

Use serverless/server-side only

Do not expose your email API key in client-side code.

Verify your sender domain

Most providers require you to:

  • verify your domain
  • set up SPF/DKIM records
  • use a real from address like noreply@yourdomain.com

Watch execution time

Vercel serverless functions have limits, so email sending should be quick. If you need retries or heavy processing, use a background job/queue.


If you just want a contact form

For a simple “contact us” form, create a server endpoint that:

  • validates input
  • rate limits requests
  • sends email to your inbox

Alternative: use a server action

If you’re using Next.js Server Actions, you can send email directly in the action instead of an API route, but the same rule applies: the code must run server-side.


Best practices

  • Validate form input
  • Add spam protection (honeypot, CAPTCHA, rate limiting)
  • Handle errors gracefully
  • Keep API keys in environment variables
  • Use a verified sending domain

If you want, I can give you:

  • a Next.js + Resend full working example,
  • a contact form implementation,
  • or examples using SendGrid/Postmark/Mailgun.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (7 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.