How to Install MailHog on Latest Debian?

MailHog is an email testing tool similar to Mailtrap. It helps you test emails received by your applications during development, especially when you do not want to send emails to real-life service providers. In this tutorial, we will show you how to install MailHog on the latest Debian system.

Prerequisites

Before proceeding, make sure you have the following:

Steps to Install MailHog

Follow the steps below to install MailHog on your Debian system:

Step 1: Update your System

It is a recommended task to update your Debian system before installing any new software. Run the command below to update your system:

sudo apt update && sudo apt upgrade

This command will update the package lists and upgrade any outdated packages on your system.

Step 2: Install the Required Packages

Install MailHog on your Debian system along with its dependencies by running the command below:

sudo apt install golang-go git

This command will install Git (a version control system) and Golang (a programming language necessary to run MailHog).

Step 3: Clone MailHog from GitHub

To clone MailHog's repository, run the command below:

cd ~ && git clone https://github.com/mailhog/MailHog.git

This command will clone the entire MailHog repository into your home directory.

Step 4: Build MailHog

To build MailHog, navigate to the directory where you cloned it by running:

cd ~/MailHog

Now, build MailHog with the following command:

go build

This command will build MailHog, which may take a few minutes.

Step 5: Run MailHog

Run the command below to start MailHog:

./MailHog

This command will start MailHog on your local machine. The application will listen to port 1025 for SMTP connections and port 8025 for the Web UI.

Step 6: Access MailHog Web Interface

To access the MailHog web interface, open a web browser and navigate to http://localhost:8025. This will open the MailHog web interface where you can view sent emails.

Step 7: Configure Your Email Clients

Now that MailHog is running, configure your email clients to use it as an SMTP server. The SMTP server address should be localhost, and the port should be 1025. If your email client has SSL enabled, then enable SSL support as well.

Congratulations, you have now successfully installed MailHog on your Debian system.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!