Mailpit

How to Install Mailpit on Ubuntu 24.04

Mailpit is a lightweight, self-hosted SMTP testing tool that lets developers capture and inspect emails sent from applications during development. It provides a web interface to view emails, supports multiple SMTP ports, and stores messages locally for easy testing and debugging. Using Docker ensures a consistent, simple setup, while Ubuntu 24.04 LTS (Noble Numbat) provides a modern, secure, and stable platform.

 

Why Use Mailpit?

  • Development-Friendly – Capture emails without sending them to real users.

  • Web Interface – View emails, search, and inspect message contents.

  • Persistent Storage – Store messages in a local SQLite database for later review.

  • Customizable SMTP – Supports multiple ports and flexible authentication settings.

  • Docker-Ready – Easy deployment and updates through containerization.

 

Step-by-Step Installation

1. Connect to Your Server

Log in to your Ubuntu 24.04 server via SSH:

 
ssh root@your-server-ip

2. Update System and Install Prerequisites

Update package lists and upgrade existing packages:

 
apt update && apt upgrade -y

Install required dependencies:

 
apt install -y apt-transport-https ca-certificates curl gnupg lsb-release python3-venv python3-pip

3. Install Docker

Add Docker’s GPG key and repository:

 
mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list apt update

Install Docker packages:

 
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

Enable and start Docker:

 
systemctl enable --now docker

Optionally, add your user to the Docker group for non-root access:

 
usermod -aG docker $USER

Log out and back in to apply group changes.

4. Prepare Mailpit Data Directory

Create a persistent directory for Mailpit messages and database:

 
mkdir -p /opt/mailpit/data chmod 755 /opt/mailpit/data

5. Pull and Run the Mailpit Docker Container

Download the latest Mailpit image:

 
docker pull axllent/mailpit:latest

Run Mailpit:

 
docker run -d \ --name mailpit \ -p 8025:8025 \ -p 1025:1025 \ -v /opt/mailpit/data:/data \ -e MP_MAX_MESSAGES=5000 \ -e MP_DATABASE=/data/mailpit.db \ -e MP_SMTP_AUTH_ACCEPT_ANY=1 \ -e MP_SMTP_AUTH_ALLOW_INSECURE=1 \ --restart unless-stopped \ axllent/mailpit:latest

Key parameters explained:

  • -p 8025:8025 exposes the Mailpit web interface.

  • -p 1025:1025 exposes the SMTP server for applications to send test emails.

  • -v /opt/mailpit/data:/data stores all captured messages persistently.

  • Environment variables configure maximum messages, database location, and SMTP authentication behavior.

  • --restart unless-stopped ensures Mailpit restarts automatically on system reboot.

6. Access the Web Interface

Open a browser and navigate to:

 

 
http://<your-server-ip>:8025
  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

ERPNext v15

Last Updated: 31 August 2025Applies to: Ubuntu 24.04 LTS (fresh server recommended)Skill Level:...

Open-EMR v7.0.3

Last Updated: 31 August 2025Applies to: Ubuntu 24.04 LTS (fresh server recommended)Skill Level:...

ERPNext v14

Last Updated: 31 August 2025Applies to: Ubuntu 24.04 LTS (fresh server recommended)Skill Level:...

WordPress

1. Overview WordPress is the most popular open-source blogging system and CMS on the Web. It...

Joomla

How to Install Joomla on Ubuntu 24.04   Joomla is a free and open-source content management...