Convert Figma logo to code with AI

axllent logomailpit

An email and SMTP testing tool with API for developers

7,456
205
7,456
3

Top Related Projects

smtp4dev - the fake smtp email server for development and testing

15,110

Web and API based SMTP testing

Catches mail and serves it through a dream.

Disposable webmail server (similar to Mailinator) with built in SMTP, POP3, RESTful servers; no DB required.

5,624

:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.

Quick Overview

Mailpit is an email testing tool for developers. It acts as an SMTP server, catching all outgoing emails from your application and displaying them in a web interface. This allows for easy testing and debugging of email functionality without sending actual emails.

Pros

  • Easy to set up and use, with minimal configuration required
  • Provides a clean, user-friendly web interface for viewing captured emails
  • Supports both plain text and HTML email formats
  • Offers API access for integration with other tools and automated testing

Cons

  • Limited to local development and testing environments, not suitable for production use
  • May require additional setup for integration with certain frameworks or email libraries
  • Lacks advanced features like email filtering or complex routing rules
  • No built-in support for simulating email delivery delays or failures

Getting Started

To get started with Mailpit, follow these steps:

  1. Download the latest release for your operating system from the GitHub releases page.

  2. Extract the downloaded archive and run the Mailpit executable:

./mailpit
  1. Configure your application to use Mailpit as the SMTP server:
SMTP Host: localhost
SMTP Port: 1025
  1. Access the web interface at http://localhost:8025 to view captured emails.

For Docker users, you can run Mailpit using the following command:

docker run -p 8025:8025 -p 1025:1025 axllent/mailpit

Competitor Comparisons

smtp4dev - the fake smtp email server for development and testing

Pros of smtp4dev

  • More comprehensive email testing features, including IMAP server simulation
  • Supports multiple SMTP ports and SSL/TLS configurations
  • Offers a REST API for programmatic access to captured messages

Cons of smtp4dev

  • Heavier resource usage due to its .NET Core backend
  • More complex setup and configuration process
  • Less frequent updates and maintenance compared to Mailpit

Code Comparison

smtp4dev (C#):

public class SmtpServer : ISmtpServer
{
    public Task<bool> AcceptMessageAsync(IMessageTransaction transaction, CancellationToken cancellationToken)
    {
        // SMTP message handling logic
    }
}

Mailpit (Go):

func (s *SMTPServer) handleMessage(peer smtpd.Peer, env smtpd.Envelope) error {
    // SMTP message handling logic
}

Both projects serve as fake SMTP servers for testing email functionality in development environments. Mailpit is lightweight, fast, and easy to set up, making it ideal for simple email testing scenarios. smtp4dev offers more advanced features and customization options, suitable for complex email testing requirements. Mailpit is written in Go, which contributes to its performance and cross-platform compatibility, while smtp4dev is built on .NET Core, providing a rich set of features at the cost of increased resource usage.

15,110

Web and API based SMTP testing

Pros of MailHog

  • More established project with a larger user base and community support
  • Supports SMTP authentication for testing secure email configurations
  • Offers a REST API for programmatic access to captured emails

Cons of MailHog

  • No longer actively maintained, with the last commit in 2019
  • Written in Go, which may be less familiar to some developers compared to Mailpit's Golang implementation
  • Lacks some modern features like real-time updates and advanced search capabilities

Code Comparison

MailHog (configuration example):

cfg := &config.Config{
    SMTPBindAddr: "0.0.0.0:1025",
    APIBindAddr:  "0.0.0.0:8025",
    Hostname:     "localhost",
}

Mailpit (configuration example):

config := &Config{
    HTTPListen:  "0.0.0.0:8025",
    SMTPListen:  "0.0.0.0:1025",
    AllowedIPs:  []string{"127.0.0.1", "::1"},
    MaxMessages: 500,
}

Both projects serve similar purposes as email testing tools, but Mailpit is more actively maintained and offers some modern features. MailHog has a larger existing user base but lacks recent updates. The code examples show similar configuration approaches, with Mailpit offering additional options like IP restrictions and message limits out of the box.

Catches mail and serves it through a dream.

Pros of Mailcatcher

  • Written in Ruby, which may be preferred by Ruby developers
  • Longer project history and potentially more mature codebase
  • Supports SMTP authentication

Cons of Mailcatcher

  • Less actively maintained (last commit over 2 years ago)
  • Fewer features compared to Mailpit (e.g., no API, no message storage)
  • May have performance limitations with large volumes of emails

Code Comparison

Mailcatcher (Ruby):

require 'eventmachine'
require 'mail'

EM.run do
  EM.start_server('127.0.0.1', 1025, SMTPServer)
end

Mailpit (Go):

package main

import (
    "github.com/axllent/mailpit/server"
)

func main() {
    server.Start()
}

Key Differences

  • Language: Mailcatcher is written in Ruby, while Mailpit is written in Go
  • Features: Mailpit offers more advanced features like API access and message storage
  • Performance: Mailpit is likely to handle larger email volumes more efficiently due to Go's concurrency model
  • Maintenance: Mailpit is more actively maintained and updated
  • UI: Both provide web interfaces, but Mailpit's UI is more modern and feature-rich

Conclusion

While Mailcatcher has been a popular choice for local email testing, Mailpit offers a more modern, feature-rich, and actively maintained alternative. Developers looking for better performance and additional functionality may find Mailpit more suitable for their needs.

Disposable webmail server (similar to Mailinator) with built in SMTP, POP3, RESTful servers; no DB required.

Pros of Inbucket

  • More mature project with a longer development history
  • Supports multiple storage backends (memory, file system, MongoDB)
  • Offers a REST API for programmatic access to messages

Cons of Inbucket

  • Less frequent updates and maintenance
  • User interface may be less modern and intuitive
  • Lacks some advanced features like DKIM verification

Code Comparison

Inbucket (Go):

func (s *HTTPServer) createWebSocket(w http.ResponseWriter, req *http.Request) {
    conn, err := s.upgrader.Upgrade(w, req, nil)
    if err != nil {
        log.WithError(err).Error("Failed to upgrade WebSocket")
        return
    }
    defer conn.Close()
    // WebSocket handling logic
}

Mailpit (Go):

func (s *Server) wsHandler(w http.ResponseWriter, r *http.Request) {
    conn, err := upgrader.Upgrade(w, r, nil)
    if err != nil {
        log.Error().Err(err).Msg("Error upgrading to WebSocket")
        return
    }
    defer conn.Close()
    // WebSocket handling logic
}

Both projects use similar approaches for WebSocket handling, with minor differences in logging and function naming conventions.

5,624

:mailbox: SMTP Server + Web Interface for viewing and testing emails during development.

Pros of Maildev

  • Built with Node.js, making it more familiar for JavaScript developers
  • Supports SMTP authentication for secure email testing
  • Offers a REST API for programmatic access to captured emails

Cons of Maildev

  • Less frequent updates and maintenance compared to Mailpit
  • May have higher resource usage due to being built on Node.js
  • Lacks some advanced features like email header and content analysis

Code Comparison

Maildev (JavaScript):

const MailDev = require('maildev');
const maildev = new MailDev();

maildev.listen(function(err) {
  console.log('MailDev running');
});

Mailpit (Go):

package main

import "github.com/axllent/mailpit/server"

func main() {
    server.Start()
}

Both Mailpit and Maildev are useful tools for email testing and development. Mailpit, written in Go, offers better performance and more frequent updates. It also provides advanced features like message searching and real-time updates. Maildev, on the other hand, may be more appealing to JavaScript developers and offers SMTP authentication out of the box. The choice between the two depends on specific project requirements, development environment, and personal preferences.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Mailpit - email testing for developers

CI Tests status CI build status CI Docker build status Code quality Go Report Card
Latest release Docker pulls

Website • Documentation • API


Mailpit is a small, fast, low memory, zero-dependency, multi-platform email testing tool & API for developers.

It acts as an SMTP server, provides a modern web interface to view & test captured emails, and includes an API for automated integration testing.

Mailpit was originally inspired by MailHog which is no longer maintained and hasn't seen active development or security updates for a few years now.

Mailpit

Features

  • Runs entirely from a single static binary or multi-architecture Docker images
  • Modern web UI with advanced mail search to view emails (formatted HTML, highlighted HTML source, text, headers, raw source, and MIME attachments including image thumbnails), including optional HTTPS & authentication
  • SMTP server with optional STARTTLS or SSL/TLS, authentication (including an "accept any" mode)
  • A REST API for integration testing
  • Real-time web UI updates using web sockets for new mail & optional browser notifications when new mail is received
  • Optional POP3 server to download captured message directly into your email client
  • HTML check to test & score mail client compatibility with HTML emails
  • Link check to test message links (HTML & text) & linked images
  • Spam check to test message "spamminess" using a running SpamAssassin server
  • Create screenshots of HTML messages via web UI
  • Mobile and tablet HTML preview toggle in desktop mode
  • Message tagging including manual tagging or automated tagging using filtering and "plus addressing"
  • SMTP relaying (message release) - relay messages via a different SMTP server including an optional allowlist of accepted recipients
  • SMTP forwarding - automatically forward messages via a different SMTP server to predefined email addresses
  • Fast message storing & processing - ingesting 100-200 emails per second over SMTP depending on CPU, network speed & email size, easily handling tens of thousands of emails, with automatic email pruning (by default keeping the most recent 500 emails)
  • Chaos feature to enable configurable SMTP errors to test application resilience
  • List-Unsubscribe syntax validation
  • Optional webhook for received messages

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 package managers

  • Mac: brew install mailpit (to run automatically in the background: brew services start mailpit)
  • Arch Linux: available in the AUR as mailpit
  • FreeBSD: pkg install mailpit

Install via script (Linux & Mac)

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

sudo sh < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)

You can also change the install path to something else by setting the INSTALL_PATH environment, for example:

INSTALL_PATH=/usr/bin sudo sh < <(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 be extracted and copied to your $PATH, or simply run as ./mailpit.

Docker

See Docker instructions for 386, amd64 & arm64 images.

Compile from source

To build Mailpit from source, see Building from source.

Usage

Run mailpit -h to see options. More information can be seen in the docs.

If installed using homebrew, you may run brew services start mailpit to always run mailpit automatically.

Testing Mailpit

Please refer to the documentation on how to easily test email delivery to Mailpit.

Configuring sendmail

Mailpit's SMTP server (default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to an SMTP server is sendmail, used by many applications, including PHP. Mailpit can also act as substitute for sendmail. For instructions on how to set this up, please refer to the sendmail documentation.