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

mailstub

v0.1.1

Published

Email testing tool for developers

Downloads

8

Readme

MailStub

A lightweight email testing tool for developers. Catch and view test emails in a clean interface without sending to real inboxes.

Features

  • 📧 Organized Projects - Separate emails by project for easy management
  • 👥 Multiple Users - Create test users and send to different recipients
  • 🎨 Clean Interface - Beautiful UI with dark mode support
  • 🚀 Simple Setup - Start testing emails in minutes
  • 💾 Local Storage - All data stored locally in SQLite
  • 🔌 Easy Integration - Simple client library for sending test emails

Installation

Install MailStub globally via npm:

npm install -g mailstub

Or using your preferred package manager:

# pnpm
pnpm add -g mailstub

# yarn
yarn global add mailstub

Quick Start

1. Start the MailStub server

mailstub start

The server will start on http://localhost:8000 by default.

2. Create a project and user

Open your browser to http://localhost:8000 and:

  1. Create your first project (e.g., "My App")
  2. Add a test user with an email address (e.g., "[email protected]")
  3. Copy your project ID from the UI

3. Install the client in your application

npm install mailstub-client

Or using your preferred package manager:

# pnpm
pnpm add mailstub-client

# yarn
yarn add mailstub-client

4. Send test emails from your app

import { client } from 'mailstub-client';

await client.send('p_your-project-id', {
  sender: '[email protected]',
  receiver: '[email protected]',
  subject: 'Welcome to My App!',
  body: '<h1>Hello!</h1><p>Thanks for signing up.</p>'
});

Check the MailStub UI to see your test email!

Development vs Production

Create an abstraction layer to easily switch between MailStub for development and real email services for production:

import { client as mailstubClient } from 'mailstub-client';
import sendgrid from '@sendgrid/mail';

sendgrid.setApiKey(process.env.SENDGRID_API_KEY || '');

export async function sendEmail({ to, from, subject, html }) {
  if (process.env.NODE_ENV === 'production') {
    // Production: Use real email service
    await sendgrid.send({ to, from, subject, html });
  } else {
    // Development: Catch emails in MailStub
    await mailstubClient.send(process.env.MAILSTUB_PROJECT_ID!, {
      sender: from,
      receiver: to,
      subject,
      body: html
    });
  }
}

// Usage anywhere in your app:
await sendEmail({
  to: '[email protected]',
  from: '[email protected]',
  subject: 'Welcome!',
  html: '<h1>Welcome to our app!</h1>'
});

This pattern keeps your code clean and makes it easy to switch between testing and production environments.

CLI Options

# Start with default settings
mailstub start

# Use a custom port
mailstub start --port 3000

Available Options

  • -p, --port <number> - Port number for the server (default: 8000)
  • -V, --version - Output the version number
  • -h, --help - Display help information

Client API

client.send(projectId, options)

Send a test email to MailStub.

Parameters:

  • projectId (string) - Your project ID (format: p_xxxxx)
  • options (object):
    • sender (string) - Full sender email address
    • receiver (string) - Recipient email (must be a user in your project)
    • subject (string) - Email subject line
    • body (string) - Email body (HTML supported)

Returns: Promise with the created message object

Example:

import { client } from 'mailstub-client';

const result = await client.send('p_abc123', {
  sender: '[email protected]',
  receiver: '[email protected]',
  subject: 'Password Reset',
  body: '<p>Click here to reset your password...</p>'
});

console.log(result.message.id); // m_xyz789

Custom Server Port

By default, the client connects to http://localhost:8000. If you're running MailStub on a different port, update the client configuration:

import { createClient } from 'mailstub-client';

// Connect to MailStub running on port 3000
const client = createClient({ port: 3000 });

await client.send('p_abc123', {
  sender: '[email protected]',
  receiver: '[email protected]',
  subject: 'Password Reset',
  body: '<p>Click here to reset your password...</p>'
});

Usage Guidelines

✅ Use MailStub For:

  • Local development and testing
  • Staging and QA environments
  • CI/CD pipeline testing
  • Demo environments
  • Integration testing without real emails

❌ Don't Use MailStub For:

  • Production email delivery
  • Real customer communications
  • Sensitive or PII data
  • Compliance-regulated communications
  • High-volume or mission-critical sends

Disclaimer: MailStub is designed exclusively for testing purposes. It does not send real emails or provide delivery guarantees, encryption, or compliance features. For production environments, use a proper transactional email service like SendGrid, Postmark, or AWS SES.

Data Storage

MailStub stores all data in a SQLite database in your home directory:

  • Mac/Linux: ~/.mailstub/mailstub.db
  • Windows: C:\Users\<YourUsername>\.mailstub\mailstub.db

This database:

  • Contains only test email data
  • Uses SQLite for efficient querying and storage
  • Is created automatically on first run
  • Is unencrypted (never store sensitive information)

Security Note: The database should only contain test data. Never use MailStub for production emails or sensitive information.

Troubleshooting

Port already in use

If port 8000 is already in use, specify a different port:

mailstub start --port 3000

Database location

Your database is automatically stored in your home directory (see Data Storage section for the exact path). To view or backup your data, you can use any SQLite browser tool.

Frontend not loading

Make sure you're accessing http://localhost:8000 (or your custom port) in your browser.

License

MIT

Support


Made with ❤️ for developers who need to test emails without the hassle.