Refresh

Answers

How do I send email from a Next.js app on Vercel or Netlify?

On Vercel or Netlify, a Next.js route handler sends mail through Refresh with one fetch: a JSON POST to /api/v1/emails with a bearer API key. Code that cannot call HTTP, such as an existing Nodemailer setup, can use the SMTP relay at smtp.f5send.com on port 465 with implicit TLS.

What you get

  • Each API request carries a bearer API key and a JSON body, so one fetch call is enough.
  • An Idempotency-Key header makes a retried request return the original message id, so a retried function does not send twice.
  • A Test key lets you build and test the integration without delivering mail.
  • The SMTP relay for Nodemailer uses port 465 with implicit TLS; it has no STARTTLS and no port 587.
  • The SMTP username is the API key id, and the password is the key token.
  • Give each app its own API key, restricted to the domain of that app.
  • Webhook verification in a Next.js App Router handler needs the raw request body, not parsed JSON.

How it works

  1. Verify your sending domain, then mint a SEND key restricted to that domain in API keys.
  2. Store the token in an environment variable of the Vercel or Netlify project, never in client code.
  3. In a route handler or server action, POST the JSON body to /api/v1/emails with an Idempotency-Key header.
  4. For Nodemailer, set host smtp.f5send.com, port 465, the key id as user and the token as password.

Documentation

Create a free account: 3,000 emails a month, unlimited domains, no card.

More answers about Refresh