mailsandbox

command module
v1.28.1-mailsandbox Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2025 License: MIT Imports: 5 Imported by: 0

README

MailSandbox — email testing & simulation for developers

Fork of Mailpit adding Postmark API emulation and an MCP server for AI-assisted debugging.
Inspired by and grateful to the original work on Mailpit and MailHog. See Credits.

Build docker edge images

RepositoryInstallationUsagePostmark APIMCP Server


MailSandbox is a small, fast, low-memory, zero-dependency, multi-platform email testing tool & API for developers.
It provides an SMTP server, modern web interface, REST API, Postmark API emulation, and an MCP server for AI-powered workflows.


Features

  • 🚀 Lightweight — single static binary or multi-arch Docker image
  • 🌐 Modern Web UI — view HTML, source, headers, attachments, search & filter
  • 📬 SMTP & POP3 servers — STARTTLS/SSL/TLS, authentication, forwarding, relaying
  • 🔍 Testing tools — HTML check, link check, spam score, screenshots, mobile preview
  • 🏷 Tagging & filtering — manual or automated (incl. plus addressing)
  • Performance — 100–200 emails/sec, automatic pruning (default 500 emails)
  • 🧪 Chaos mode — inject SMTP errors to test resilience
  • 🔔 Integrations — webhooks, browser notifications, List-Unsubscribe validation
  • 🆕 Postmark API emulation — drop-in replacement for Postmark during development
  • 🤖 MCP server — AI assistants (e.g., Claude Code) can list, search, and analyze messages

Installation

The web UI runs on http://0.0.0.0:8025 and SMTP on 0.0.0.0:1025.

Script (Linux & macOS)
sudo sh < <(curl -sL https://raw.githubusercontent.com/btafoya/mailsandbox/main/install.sh)
Static binary

Download from releases, rename to mailsandbox, and add to $PATH.

Docker
docker run -d --name mailsandbox   -p 8025:8025 -p 1025:1025   btafoya/mailsandbox

Usage

List options:

mailsandbox -h

Postmark API Emulation

Enable Postmark API emulation:

mailsandbox --postmark-api --postmark-token "your-secret-token"

Environment variables:

export MP_POSTMARK_API=true
export MP_POSTMARK_TOKEN=your-secret-token
mailsandbox

Example: Node.js

const postmark = require("postmark");
const client = new postmark.ServerClient("your-secret-token");
client.apiUrl = "http://localhost:8025";
client.sendEmail({ From:"a@x.com", To:"b@y.com", Subject:"Test", TextBody:"Hello" });

Endpoints:

  • POST /email
  • POST /email/batch
  • POST /email/withTemplate

MCP Server for AI Assistants

Enable MCP server:

mailsandbox --mcp-server --mcp-transport stdio

Environment variables:

export MP_MCP_SERVER=true
export MP_MCP_TRANSPORT=stdio
Docker with MCP
docker build -t mailsandbox-with-mcp .
docker run -d --name mailsandbox   -p 127.0.0.1:8025:8025 -p 1025:1025   -e MP_MCP_SERVER=true   -e MP_MCP_TRANSPORT=stdio   -e MP_POSTMARK_API=true   -e MP_POSTMARK_TOKEN=dev-token-123   mailsandbox-with-mcp
MCP tools
  • list_messages — list/filter emails
  • get_message — retrieve full message
  • search_messages — advanced search
  • analyze_message — HTML, links, spam scoring

Migration Guide

  • Binary name remains mailpit; create a symlink if you prefer mailsandbox.
  • Default ports unchanged: HTTP 8025, SMTP 1025.
  • APIs: REST API unchanged; Postmark & MCP are opt-in.
  • Docker: use forked image for MCP/Postmark features.

Credits & Acknowledgements

  • Mailpit — by Axel Lenferna de la Motte and contributors. Original project and active development.
  • MailHog — the original inspiration for mainer email testing tools.
  • MailSandbox — maintained by Brian Tafoya, adding Postmark API emulation and MCP server support.

License

MailSandbox inherits the upstream license from Mailpit. See LICENSE for details.

Documentation

Overview

Package main is the entrypoint

Directories

Path Synopsis
Package cmd is the main application
Package cmd is the main application
Package config handles the application configuration
Package config handles the application configuration
internal
auth
Package auth handles the web UI and SMTP authentication
Package auth handles the web UI and SMTP authentication
dump
Package dump is used to export all messages from mailpit into a directory
Package dump is used to export all messages from mailpit into a directory
html2text
Package html2text is a simple library to convert HTML to plain text
Package html2text is a simple library to convert HTML to plain text
htmlcheck
Package htmlcheck is used for parsing HTML and returning HTML compatibility errors and warnings
Package htmlcheck is used for parsing HTML and returning HTML compatibility errors and warnings
linkcheck
Package linkcheck handles message links checking
Package linkcheck handles message links checking
logger
Package logger handles the logging
Package logger handles the logging
pop3
Package pop3 is a simple POP3 server for Mailpit.
Package pop3 is a simple POP3 server for Mailpit.
pop3client
Package pop3client is borrowed directly from https://github.com/knadh/go-pop3 to reduce dependencies.
Package pop3client is borrowed directly from https://github.com/knadh/go-pop3 to reduce dependencies.
prometheus
Package prometheus provides Prometheus metrics for Mailpit
Package prometheus provides Prometheus metrics for Mailpit
smtpd
Package smtpd is the SMTP daemon
Package smtpd is the SMTP daemon
smtpd/chaos
Package chaos is used to simulate Chaos engineering (random failures) in the SMTPD server.
Package chaos is used to simulate Chaos engineering (random failures) in the SMTPD server.
snakeoil
Package snakeoil provides functionality to generate a temporary self-signed certificates for testing purposes.
Package snakeoil provides functionality to generate a temporary self-signed certificates for testing purposes.
spamassassin
Package spamassassin will return results from either a SpamAssassin server or Postmark's public API depending on configuration
Package spamassassin will return results from either a SpamAssassin server or Postmark's public API depending on configuration
spamassassin/postmark
Package postmark uses the free https://spamcheck.postmarkapp.com/ See https://spamcheck.postmarkapp.com/doc/ for more details.
Package postmark uses the free https://spamcheck.postmarkapp.com/ See https://spamcheck.postmarkapp.com/doc/ for more details.
spamassassin/spamc
Package spamc provides a client for the SpamAssassin spamd protocol.
Package spamc provides a client for the SpamAssassin spamd protocol.
stats
Package stats stores and returns Mailpit statistics
Package stats stores and returns Mailpit statistics
storage
Package storage handles all database actions
Package storage handles all database actions
tools
Package tools provides various methods for various things
Package tools provides various methods for various things
cmd
Package cmd is the sendmail cli
Package cmd is the sendmail cli
Package server is the HTTP daemon
Package server is the HTTP daemon
apiv1
Package apiv1 handles all the API responses
Package apiv1 handles all the API responses
handlers
Package handlers contains a specific handlers
Package handlers contains a specific handlers
mcp
webhook
Package webhook will optionally call a preconfigured endpoint
Package webhook will optionally call a preconfigured endpoint
websockets
Package websockets is used to broadcast messages to connected clients
Package websockets is used to broadcast messages to connected clients

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL