Features / Email System

Email System.

Send transactional and notification emails via Resend, SMTP, or SendLayer. Built-in templates with variable interpolation and database-managed providers.

Nextly's email system handles transactional emails for authentication flows (welcome, password reset, email verification) and supports custom email sending through a provider-agnostic API.

You can configure an email provider in code via defineConfig() or manage providers directly from the admin panel. Database-configured providers take priority over code config, so you can update credentials without redeploying. All credentials are encrypted at rest with AES-256-GCM.

The template engine supports {{placeholder}} variable interpolation with HTML escaping and dot notation for nested values. Three built-in templates cover common auth flows, and you can create custom templates for any purpose.

Key capabilities

  • Three Providers — Resend (modern API), SMTP (any server via nodemailer), or SendLayer (REST API). Switch providers without changing your sending code.
  • Template System — Built-in templates for welcome, password reset, and email verification. Variable interpolation with {{placeholders}} and HTML layout composition.
  • Encrypted Credentials — Provider credentials are encrypted at rest with AES-256-GCM. The admin API returns masked values, and secrets never leave the server.
  • Database-Configured Providers — Create, test, and switch providers from the admin panel. Set a default provider and override per-email when needed. Code config works as fallback.

Pick your provider

All three providers share the same sending API, so you can switch without changing code.

Resend — modern API, Resend SDK:

{
  provider: "resend",
  apiKey: "re_xxxxx",
}

SMTP — any SMTP server via nodemailer:

{
  provider: "smtp",
  host: "smtp.gmail.com",
  port: 587,
  auth: {
    user: "...",
    pass: "...",
  },
}

SendLayer — REST API, native fetch:

{
  provider: "sendlayer",
  apiKey: "xxxxx",
}

Email provider setup

import { defineConfig } from "nextly/config";

export default defineConfig({
  email: {
    providerConfig: {
      provider: "resend",
      apiKey: process.env.RESEND_API_KEY!,
    },
    from: "My App <noreply@example.com>",
    baseUrl: "https://example.com",
    resetPasswordPath: "/auth/reset-password",
    verifyEmailPath: "/auth/verify-email",
  },
});

Provider priority: admin-configured provider, then code config, then error. You can manage providers from the admin panel and override the code config at any time.

Built-in templates with variables

Three built-in templates for common auth flows. Each supports variable interpolation with {{placeholders}} and is wrapped in a shared HTML layout.

await emailService.sendWithTemplate("password-reset", "user@example.com", {
  resetLink: "https://example.com/reset?token=abc123",
  expiresIn: "1 hour",
  appName: "My App",
  userName: "John Doe",
});
  • welcome — Sent after registration (variables: userName, appName).
  • password-reset — Sent on reset request (variables: resetLink, expiresIn, appName).
  • email-verification — Sent for verification (variables: verifyLink, expiresIn, appName).

Variables are HTML-escaped by default to prevent XSS. Dot notation is supported: {{user.name}} resolves nested values.

Which provider to use

  • Resend — Setup: 1 API key; library: Resend SDK; best for production SaaS.
  • SMTP — Setup: host, port, auth; library: nodemailer; best for self-hosted / enterprise.
  • SendLayer — Setup: 1 API key; library: native fetch; best as a Resend alternative.

Start building with Nextly

Free, open source, and yours to own. No sign-up required.

Terminal