Starter · Next.js
A working Next.js send in one deploy.
A server-only API route, test mode on by default, a signed webhook handler and MCP config for Cursor and OpenCode. Replace the placeholders, verify a domain, send the first message.
Server-only
The API key stays in the route handler. The browser never receives it.
Test mode
The first send returns a synthetic outcome without SMTP delivery or usage.
Signed webhooks
The handler verifies the raw body before parsing the event.
MCP included
Cursor and OpenCode configs are in the repository for delivery-state inspection.
The entire send
One server route, one SDK call.
The starter uses @transmitly/sdk and returns the accepted message object. Test mode is controlled by one environment variable, so a fresh deploy cannot send real mail by accident.
import { NextResponse } from "next/server";
import { Transmitly } from "@transmitly/sdk";
export async function POST(request: Request) {
const { email } = await request.json();
const tx = new Transmitly({ apiKey: process.env.TRANSMITLY_API_KEY! });
const accepted = await tx.emails.send({
from: process.env.TRANSMITLY_FROM!,
to: [email],
subject: "Your Transmitly starter is working",
html: "<p>This message was accepted by Transmitly.</p>",
test_mode: process.env.TRANSMITLY_TEST_MODE !== "false",
});
return NextResponse.json(accepted, { status: 202 });
}Three steps
Deploy, set four values, send.
- 01
Deploy or clone
Use the Vercel button or clone the repository. The starter is a normal Next.js App Router app.
- 02
Set the environment
TRANSMITLY_API_KEY, TRANSMITLY_FROM, TRANSMITLY_TEST_MODE and TRANSMITLY_WEBHOOK_SECRET.
- 03
Send and inspect
Send the test, open the trace, then turn test mode off after the domain is verified.
You need a verified sending domain and an API key with the send scope. The webhook secret comes from the endpoint you create in Transmitly. See the SDK reference and MCP guide.
Start with a working send.
Deploy the starter, keep test mode on, and inspect the acceptance trace before you connect production traffic.