Next.js

Send email from Next.js.

Add Xurel to any Next.js app with a route handler and React Email.

01

Install

Add the official SDK to your project.


                npm i xurel
              
02

Add your API key

Store the key in your environment. Never commit it.


                XUREL_API_KEY=xrl_prd_xxxxxxxx
              
03

Send in a route handler

Use an App Router route handler (or Server Action) to send.


                import { Xurel } from 'xurel';
import { NextResponse } from 'next/server';

const xurel = new Xurel(process.env.XUREL_API_KEY!);

export async function POST() {
  const data = await xurel.emails.send({
    from: 'hello@yourdomain.com',
    to: 'user@example.com',
    subject: 'Hello from Next.js',
    html: '<p>It works.</p>',
  });
  return NextResponse.json(data);
}
              

Ship your first email today.

Create an account, verify your domain, and send in minutes.