mailpit

command module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 5 Imported by: 0

README

Mailpit - email testing for developers

Tests Build status Docker builds CodeQL Go Report Card

Mailpit is a multi-platform email testing tool & API for developers.

It acts as both an SMTP server, and provides a web interface to view all captured emails.

Mailpit is inspired by MailHog, but much, much faster.

Mailpit

Features

  • Runs entirely from a single binary, no installation required
  • SMTP server (default 0.0.0.0:1025)
  • Web UI to view emails (formatted HTML, highlighted HTML source, text, headers, raw source and MIME attachments including image thumbnails)
  • Mobile and tablet HTML preview toggle in desktop mode
  • Advanced mail search (see wiki)
  • Message tagging (see wiki)
  • Real-time web UI updates using web sockets for new mail
  • Optional browser notifications for new mail (HTTPS only)
  • Configurable automatic email pruning (default keeps the most recent 500 emails)
  • Email storage either in a temporary or persistent database (see wiki)
  • Fast SMTP processing & storing - approximately 70-100 emails per second depending on CPU, network speed & email size, easily handling tens of thousands of emails
  • SMTP relaying / message release - relay messages via a different SMTP server (see wiki)
  • Optional SMTP with STARTTLS & SMTP authentication, including an "accept anything" mode (see wiki)
  • Optional HTTPS for web UI (see wiki)
  • Optional basic authentication for web UI (see wiki)
  • A simple REST API (see docs)
  • Multi-architecture Docker images

Installation

The Mailpit web UI listens by default on http://0.0.0.0:8025, and the SMTP port on 0.0.0.0:1025.

Mailpit runs as a single binary and can be installed in different ways:

Install via Brew (Mac)

Add the repository to your taps with brew tap axllent/apps, and then install Mailpit with brew install mailpit.

Install via bash script (Linux & Mac)

Linux & Mac users can install it directly to /usr/local/bin/mailpit with:

sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)
Download static binary (Windows, Linux and Mac)

Static binaries can always be found on the releases. The mailpit binary can extracted and copied to your $PATH, or simply run as ./mailpit.

Docker

See Docker instructions.

Compile from source

To build Mailpit from source see building from source.

Configuring sendmail

There are several different options available:

You can use mailpit sendmail as your sendmail configuration in php.ini:

sendmail_path = /usr/local/bin/mailpit sendmail

If Mailpit is found on the same host as sendmail, you can symlink the Mailpit binary to sendmail, eg: ln -s /usr/local/bin/mailpit /usr/sbin/sendmail (only if Mailpit is running on default 1025 port).

You can use your default system sendmail binary to route directly to port 1025 (configurable) by calling /usr/sbin/sendmail -S localhost:1025.

You can build a Mailpit-specific sendmail binary from source (see building from source).

Why rewrite MailHog?

I had been using MailHog for a few years to intercept and test emails generated from several projects. MailHog has a number of performance issues, many of the frontend and Go modules are horribly out of date, and it is not actively developed.

Initially I tried to upgrade a fork of MailHog (both the UI as well as the HTTP server & API), but soon discovered that it is (with all due respect to its authors) poorly designed. It is in my opinion over-engineered (split over 9 separate projects), and performs very poorly when dealing with large amounts of emails or processing emails with an attachments (a single email with a 3MB attachment can take over a minute to ingest). Finally, the API transmits a lot of duplicate and unnecessary data on every browser request, and there is no HTTP compression.

In order to improve it I felt it needed to be completely rewritten, and so Mailpit was born.

Documentation

The Go Gopher

There is no documentation for this package.

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
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
smtpd
Package smtpd is the SMTP daemon
Package smtpd is the SMTP daemon
Package storage handles all database actions
Package storage handles all database actions
utils
logger
Package logger handles the logging
Package logger handles the logging
tools
Package tools provides various methods for variouws things
Package tools provides various methods for variouws things

Jump to

Keyboard shortcuts

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