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

fast-mailer

v2.0.0

Published

High-performance, intelligent email delivery system powered by advanced technology

Readme

Fast-Mailer

High-performance, intelligent email delivery system powered by advanced technology.

Features

  • 🚀 High-performance email sending with connection pooling
  • 🔒 TLS/SSL security with modern cipher support
  • 🛡️ Advanced rate limiting and spam protection
  • 📊 Detailed metrics and monitoring
  • 📎 Attachment support with MIME type detection
  • ♻️ Comprehensive error handling and retries
  • 📝 Logging with customizable formats and levels
  • 🔷 TypeScript support with full type definitions

What's new in v2.0

  • ✨ Enhanced rate limiting with per-recipient tracking and rapid attempt detection
  • 🔒 Improved security with TLS 1.2/1.3 and modern cipher suites
  • 📊 Extended metrics with detailed failure tracking
  • 🛡️ Advanced spam protection with recipient banning
  • 📝 Enhanced logging with masking of sensitive data
  • ♻️ Improved error handling with detailed error context

FastMailer vs NodeMailer

  • 🚀 Up to 5x faster email sending with connection pooling
  • 🔒 Modern TLS/SSL security with cipher suite control
  • 🛡️ Advanced rate limiting and spam protection
  • 📊 Comprehensive metrics and monitoring
  • 📎 Smart MIME type detection for attachments
  • ♻️ Intelligent error handling and retries
  • 📝 Structured logging with customizable formats
  • 🔷 Full TypeScript support with type definitions

Installation

npm install fast-mailer

Basic Example

import { FastMailer } from 'fast-mailer';

const mailer = new FastMailer({
    host: 'smtp.example.com',
    port: 465,
    secure: true,
    auth: {
        user: '[email protected]',
        pass: 'password'
    },
    from: '[email protected]'
});

Sending an Email

mailer.send({
    to: '[email protected]',
    subject: 'Hello, world!',
    text: 'This is a test email.'
});

Sending an Email with Attachments

 mailer.send({
    to: '[email protected]',
    subject: 'Hello, world!',
    text: 'This is a test email.',
    attachments: [{ filename: 'example.txt', path: 'path/to/example.txt' }]
});

Using a Custom Logger


const mailer = new FastMailer({
    host: 'smtp.example.com',
    port: 465,
    secure: true,
    from: '[email protected]',
    auth: {
        user: '[email protected]',
        pass: 'password'
    },
    logging: {
        level: 'debug', // 'debug', 'info', 'warn', 'error'
        format: 'json', // 'json' or 'text'
        destination: 'logs/mailer.log',
        customFields: ['messageId', 'recipients'] // Additional fields to include
    }
});

// Logs will be written to logs/mailer.log with entries like:
// JSON format:
{
    "timestamp": "2024-02-20T10:30:45.123Z",
    "level": "info",
    "event": "mail_success", 
    "messageId": "abc123",
    "recipients": ["[email protected]"],
    "subject": "Test Email",
    "sendTime": 150
}

// Text format:
// [2024-02-20T10:30:45.123Z] INFO: {"event":"mail_success","messageId":"abc123",...}

Using Metrics


const mailer = new FastMailer({
    host: 'smtp.example.com',
    port: 465,
    secure: true,
    from: '[email protected]',
    auth: {
        user: '[email protected]',
        pass: 'password'
    }
});

// Get current metrics
const metrics = mailer.getMetrics();

console.log('Email Metrics:', {
    total: metrics.emails_total,
    successful: metrics.emails_successful, 
    failed: metrics.emails_failed,
    avgSendTime: metrics.email_send_duration_seconds.avg,
    sendRate: metrics.email_send_rate,
    activeConnections: metrics.active_connections,
    errorsByType: metrics.errors_by_type
});

Rate Limiting


const mailer = new FastMailer({
    host: 'smtp.example.com',
    port: 465,
    secure: true,
    from: '[email protected]',
    auth: {
        user: '[email protected]',
        pass: 'password'
    },
    rateLimiting: {
        perRecipient: true,
        burstLimit: 5,
        cooldownPeriod: 1000,
        banDuration: 7200000,
        maxConsecutiveFailures: 3,
        failureCooldown: 300000
    }
});

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | host | string | - | SMTP server hostname (required) | | port | number | - | SMTP server port (required) | | secure | boolean | false | Whether to use TLS/SSL connection | | auth | object | - | Authentication credentials (required) | | auth.user | string | - | SMTP username | | auth.pass | string | - | SMTP password | | from | string | - | Default sender email address (required) | | retryAttempts | number | 3 | Number of retry attempts for failed sends | | timeout | number | 5000 | Socket timeout in milliseconds | | keepAlive | boolean | false | Keep connection alive between sends | | poolSize | number | 5 | Maximum number of simultaneous connections | | rateLimiting | object | - | Rate limiting configuration | | rateLimiting.perRecipient | boolean | true | Apply limits per recipient | | rateLimiting.burstLimit | number | 5 | Maximum emails per cooldown period | | rateLimiting.cooldownPeriod | number | 1000 | Cooldown period in milliseconds | | rateLimiting.banDuration | number | 7200000 | Ban duration in milliseconds (2 hours) | | rateLimiting.maxConsecutiveFailures | number | 3 | Max failures before temp ban | | rateLimiting.failureCooldown | number | 300000 | Failure cooldown in milliseconds (5 min) | | rateLimiting.maxRapidAttempts | number | 5 | Max rapid attempts before temp ban | | rateLimiting.rapidPeriod | number | 10000 | Rapid period in milliseconds (10 seconds) | | logging | object | - | Logging configuration | | logging.level | string | 'info' | Log level ('debug','info','warn','error') | | logging.format | string | 'json' | Log format ('json' or 'text') | | logging.customFields | string[] | [] | Additional fields to include in logs | | logging.destination | string | - | Log file path |

License

This project is licensed under the MIT License. See the LICENSE file for details.