NextMail

SDKs

Official client libraries for sending email and handling webhooks. All SDKs wrap the same REST API — anything you can do with curl, you can do with the SDK.

Node / TypeScript Stable

Works in Node 18+, every modern bundler, and edge runtimes that support fetch.

install
pnpm add @cybersquad/nextmail
send.ts
import { NextMail } from '@cybersquad/nextmail';

const mail = new NextMail({ apiKey: process.env.NEXTMAIL_KEY! });

const { messageId } = await mail.send({
  from:    'noreply@mail.example.com',
  to:      'user@example.com',
  subject: 'Welcome',
  template: 'welcome',
  data:     { firstName: 'Sarah' },
});

console.log('Queued', messageId);

Webhook verification helper

hook.ts
import { verifyWebhook } from '@cybersquad/nextmail';

// Next.js route handler
export async function POST(req: Request) {
  const raw = await req.text();
  const sig = req.headers.get('x-nextmail-signature')!;

  if (!verifyWebhook(raw, sig, process.env.NEXTMAIL_WEBHOOK_SECRET!)) {
    return new Response('bad sig', { status: 401 });
  }

  const event = JSON.parse(raw);
  // … process event …
  return new Response('ok');
}

PHP Coming soon

Composer package cybersquad/nextmail-php targeting PHP 8.2+. Tracking issue #42 in the SDKs repo. Until then, the REST API and SMTP relay are both first-class options for PHP apps.

Python Coming soon

Will ship as nextmail on PyPI, requiring Python 3.10+. Async-first API. Targeted at Q3 2026.

Roll your own

If no SDK fits, the REST API is fine to call directly — there's no SDK magic the API doesn't expose. See the API reference for the request shape.