npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@helpful-insight/mailer

v1.0.3

Published

Unified enterprise mail service with SMTP, AWS SES, SendGrid, Mailgun, and Memory adapters

Readme

@helpful-insight/mailer

npm version License: MIT TypeScript

Unified, resilient enterprise email dispatching service for Node.js, Express, and TypeScript. Features support for multiple mail providers (SMTP, AWS SES, SendGrid, Mailgun, and DevMemory), automatic provider failover, exponential backoff retries, and comprehensive TypeScript interfaces.


🌟 Key Features

  • 🔌 Unified Multi-Provider Engine:
    • SmtpMailProvider: Direct SMTP / Nodemailer (Gmail, Postmark, Brevo, custom relays).
    • SesMailProvider: AWS Simple Email Service (SES) integration.
    • SendGridMailProvider: SendGrid HTTP API.
    • MailgunMailProvider: Mailgun API.
    • DevMemoryMailProvider: In-memory provider for unit tests, CI/CD, and local development.
  • 🛡️ Automatic Failover & High Availability:
    • Define a fallbackProvider. If the primary provider (e.g. SendGrid) suffers an outage or rate limit, the service seamlessly routes the email through the fallback provider (e.g. AWS SES or SMTP).
  • 🔄 Smart Retries with Backoff:
    • Configurable maxRetries with automatic retry handling before triggering fallback.
  • 📎 Rich Email Features:
    • HTML and plain text dual payloads.
    • Attachments, custom headers, CC, BCC, and replyTo.
    • Global defaults for sender address (defaultFrom).

📦 Installation

# npm
npm install @helpful-insight/mailer

# pnpm
pnpm add @helpful-insight/mailer

# yarn
yarn add @helpful-insight/mailer

🚀 Quick Start

1. Development Mode (In-Memory)

import { MailService, DevMemoryMailProvider } from '@helpful-insight/mailer';

const memoryProvider = new DevMemoryMailProvider();
const mailer = new MailService({
  provider: memoryProvider,
  defaultFrom: '[email protected]'
});

await mailer.send({
  to: '[email protected]',
  subject: 'Welcome to our platform',
  html: '<h1>Welcome!</h1><p>We are glad to have you.</p>',
  text: 'Welcome! We are glad to have you.'
});

// Inspect sent emails in tests
console.log(memoryProvider.getSentEmails());

2. Production SMTP (Nodemailer / Postmark / Gmail)

import { MailService, SmtpMailProvider } from '@helpful-insight/mailer';

const smtpProvider = new SmtpMailProvider({
  host: process.env.SMTP_HOST || 'smtp.sendgrid.net',
  port: Number(process.env.SMTP_PORT) || 587,
  secure: false,
  auth: {
    user: process.env.SMTP_USER!,
    pass: process.env.SMTP_PASS!
  }
});

const mailer = new MailService({
  provider: smtpProvider,
  defaultFrom: 'Acme Support <[email protected]>'
});

const result = await mailer.send({
  to: '[email protected]',
  subject: 'Your Invoice #1042',
  html: '<p>Thank you for your purchase.</p>'
});

console.log(result.success, result.messageId);

🛡️ High-Availability Failover Configuration

Protect mission-critical transactional emails (e.g., OTPs and password resets) with automatic secondary provider routing:

import {
  MailService,
  SendGridMailProvider,
  SmtpMailProvider
} from '@helpful-insight/mailer';

const primaryProvider = new SendGridMailProvider({
  apiKey: process.env.SENDGRID_API_KEY!
});

const backupProvider = new SmtpMailProvider({
  host: process.env.BACKUP_SMTP_HOST!,
  port: 587,
  auth: {
    user: process.env.BACKUP_SMTP_USER!,
    pass: process.env.BACKUP_SMTP_PASS!
  }
});

const resilientMailer = new MailService({
  provider: primaryProvider,      // Primary carrier
  fallbackProvider: backupProvider,// Automatically takes over if primary fails
  maxRetries: 2,
  defaultFrom: '[email protected]'
});

const response = await resilientMailer.send({
  to: '[email protected]',
  subject: 'Critical Security Alert',
  text: 'Unusual login detected.'
});

console.log(`Dispatched via provider: ${response.provider}`);
// If SendGrid was down, response.provider will be 'smtp'

📄 License

MIT © Helpful Insight Private Limited