Introduction

NexoMailer SDK

AI-powered email infrastructure SDK

NexoMailer is a professional Node.js framework for developers who need more than just a simple mailer. It combines multi-provider failover, AI-driven personalization, and private analytics into a single, cohesive SDK.


⚡ Quick Start

1. Installation

Install the core framework and essential plugins via npm:

npm install @nexomailer/core @nexomailer/providers @nexomailer/analytics

(You can also use pnpm add or yarn add)

2. Basic Configuration

import { NexoMailer } from '@nexomailer/core';
 
// Initialize the mailer with your basic setup
const mailer = new NexoMailer({
  // Define at least one provider (SMTP, Resend, etc.)
  providers: [{
    type: 'smtp',
    priority: 1,
    config: { 
      host: 'smtp.gmail.com', 
      port: 587, 
      auth: { user: '...', pass: '...' } 
    }
  }],
  // Connect to your MongoDB for private analytics
  analytics: {
    mongodbUri: process.env.MONGODB_URI
  }
});
 
await mailer.init();

📦 Package Ecosystem

To keep the SDK lightweight, NexoMailer is split into specialized packages. You only install what you need.

PackageRoleWhy use it?
@nexomailer/coreThe BrainOrchestrates failover, plugins, and module access.
@nexomailer/providersThe ConnectorsNative drivers for Resend, AWS SES, and SMTP.
@nexomailer/analyticsThe MemoryHandles MongoDB persistence and reporting.
@nexomailer/aiThe IntelligenceDirect integration with LLMs for personalization.
@nexomailer/templatesThe DesignerResponsive MJML engine with Handlebars support.
@nexomailer/queueThe SchedulerBullMQ/Redis setup for background email processing.
@nexomailer/trackingThe TrackerPixel and link tracking middleware.

🔍 Under the Hood: The Nexo ID

When you call mailer.send(), NexoMailer does something unique:

  1. It generates a Unique UUID (The Nexo ID) before sending.
  2. It uses this ID for all tracking pixels and link rewrites.
  3. It returns this ID to you immediately.

Result: Even if you use 3 different providers for one campaign (because of failover), you can track everything via a single, consistent ID in your database.


🛠️ Best Practices

[!IMPORTANT] Environment Isolation: Always use the environment tag in your analytics config (staging vs production) to keep your test data separate from real user metrics.


Ready to Dive In?