Prompt

How should I send transactional emails from Vercel serverless functions without running an SMTP server?

Technology / Cloud infrastructure6 observationsLast seen Nov 8, 2026

Latest observation

Nov 8, 2026Claude

Use a transactional email API provider and call it over HTTPS from your function.Use a transactional email API provider and call it over HTTPS from your function. You never run or maintain an SMTP server; the provider handles deliverability, retries, and reputation.

Common choices

  • Resend: very developer-friendly, simple SDK, good fit for Next.js/Vercel (and React Email templates).
  • Postmark: excellent deliverability and fast delivery for transactional-only mail.
  • SendGrid / Mailgun: mature, higher volume, more knobs.
  • Amazon SES: cheapest at scale, but more setup (IAM, sandbox exit, domain verification).

Pricing and free tiers change often, so check each provider’s current page.

Basic setup (Resend example)

Create an account and add your sending domain.

Add the DNS records they give you (SPF, DKIM, and ideally DMARC). This step matters most for inbox placement.

Create an API key and store it as an environment variable in Vercel (Project → Settings → Environment Variables), e.g. RESEND_API_KEY.

  • Install the SDK: npm i resend

Send from a route handler or API function:

ts// app/api/send/route.ts (Next.js App Router)

import { Resend } from 'resend';

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

  • export async function POST(req: Request) {

const { to, name } = await req.json();

const { data, error } = await resend.emails.send({

to,

  • subject: 'Welcome!',
  • html: <p>Hi ${name}, thanks for signing up.</p>,

});

if (error) {

  • return Response.json({ error }, { status: 500 });

}

  • return Response.json({ id: data?.id });

}

  • Most other providers work the same way: a REST call or SDK with an API key. If you’d rather avoid an SDK, a plain fetch to the provider’s HTTP API works fine too.

Serverless-specific tips

Await the send. A serverless function can be frozen once the response is returned, so un-awaited promises may never finish. If you want to respond first and send afterward, use waitUntil from @vercel/functions (or after() in recent Next.js versions).

Don’t block user-facing requests on email. For anything important (receipts, password resets), consider a queue or background job (Vercel Queues, Inngest, Trigger.dev, QStash) so failures can be retried instead of lost.

Use idempotency. Many providers support idempotency keys. Use them so retries don’t send duplicates.

Handle webhooks. Subscribe to bounce/complaint events (a Vercel function can receive them) and suppress those addresses so your reputation doesn’t suffer.

Separate streams. Keep transactional mail on its own subdomain or stream (e.g. mail.yourdomain.com) apart from marketing email.

Keep secrets server-side. Never expose the API key to client code; only read it in server functions.

Why not SMTP directly?

You can use Nodemailer with a provider’s SMTP credentials, but on serverless it’s usually worse: opening TCP connections per invocation adds latency, some environments restrict outbound SMTP ports, and you lose the richer features of the HTTP APIs (tracking, templates, idempotency). Prefer the HTTP API unless you have a specific reason.

If you tell me your framework (Next.js App Router, Pages, plain functions, SvelteKit, etc.) and roughly your volume, I can suggest a specific provider and tailor the code.10 minutes ago

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (6 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.