Modoboa Mail Server Setup: How to Send and Receive Emails Easily

Modoboa Mail Server Setup How to Send and Receive Emails EasilyModoboa is an open-source mail hosting and management platform that simplifies the process of setting up and managing email servers.

In this guide, I’ll walk you through the entire process, from purchasing a domain on Namecheap to configuring Modoboa to send and receive emails.

Prerequisites

Before you begin, ensure you have the following:

  • A Server: Dartnode VPS or dedicated server with open port 25 and a fresh installation of a supported Linux distribution (e.g., Ubuntu 24.04 or Debian 12).
  • Domain Name: A registered domain name with DNS access. You can purchase one from Namecheap.
  • Root Access: Administrative privileges on your server.
  • Basic Linux Knowledge: Familiarity with the command line and Linux system administration.

Complete Guide: Modoboa Mail Server Setup

Step 1: Purchase a Domain on Namecheap

Buy Domain on Namecheap

  1. Create a Namecheap Account: If you don’t already have an account, go to Namecheap and sign up for one.
  2. Search for a Domain: Use the search bar on the Namecheap homepage to check the availability of your desired domain name (e.g., Webshanks.com). If the domain is available, add it to your cart.
  3. Complete the Purchase: Follow the checkout process to purchase the domain. Namecheap often offers additional services like WHOIS privacy protection. Consider adding these if needed.
  4. Verify Domain Ownership: Log in to your Namecheap account and navigate to the Domain List section after purchasing. Ensure your domain is active and properly registered.

Step 2: Set Up Your Server on DartNode

DartNode VPS PlansFor this guide, we’ll use a VPS from DartNode, a reliable hosting provider known for its affordable and high-performance VPS solutions.

Follow these steps to set up your VPS:

  1. Go to the DartNode VPS page and select a plan that meets your needs (e.g., 2GB RAM, 2 vCPUs).
  2. Choose a server location close to your target audience for better performance.
  3. Select an operating system (Ubuntu 20.04/22.04/24.04 or Debian 10/11/12 recommended).
  4. Complete the purchase and wait for your VPS to be provisioned.

You can also watch the video tutorial on setting up DartNode VPS.

Once your VPS is ready, log in via SSH using the credentials provided by DartNode:

ssh root@your-server-ip

You can also use Bitvise.

Bitvise

Then setup your rDNS. Go to Network > Reverse DNS and set your PTR (e.g. mail.yourdomain.com).

DartNode rDNS

Update your server to ensure all packages are up to date:

sudo apt update && sudo apt upgrade -y

Step 3: Configure Initital DNS Records

Go to your Namecheap account and navigate to the Domain List.

Record Type Name Content Priority TTL
A webshanks.org YourServerIP Auto
A mail YourServerIP Auto
AAAA webshanks.org YourIPv6 Auto
AAAA mail YourIPv6 Auto
MX webshanks.org mail.webshanks.org 10 Auto
TXT webshanks.org v=spf1 a mx ip4:181.214.152.68 ip6:2602:f9f3:0:2::2cc ~all Auto

Step 4: Install Modoboa

Download the Modoboa Installer: Use the following commands to download and prepare the installer:

git clone https://github.com/modoboa/modoboa-installer
cd modoboa-installer
sudo ./run.py --stop-after-configfile-check <your domain>

Modoboa Create .CFG file

Open installer.cfg and set:

[certificate]
type = letsencrypt

[letsencrypt]
email = [email protected]

Then save. Use ctrl X Y.

Finally, run this command to start installing Modoboa.

sudo python3 run.py <your domain>

Your mail server will be installed with the following components:
fail2ban modoboa automx amavis clamav dovecot nginx razor postfix postwhite spamassassin uwsgi radicale opendkim
Do you confirm? (Y/n) y

Installaing Modoboa

Step 5: Access the Modoboa Admin Panel

Open your browser and navigate to https://mail.example.com. Log in using the admin credentials you set during installation.

Use the admin/password login credentials provided.

Modoboa Login Dash

Let’s add a domain.

We will use the new admin interface so click New admin.

Modoboa New Admin

Add a domain.

Modoboa Add New Domain

Enter your domain.

Modoboa New domain - General

Enable DNS checks and signing. Choose 2048 bits.

Modoboa New domain - DNS

Set limits.

Modoboa New domain - Limitations

Add a new mailbox.

Modoboa New domain - Options

Summary. If you’re good with the summary, click Confirm and Create.

Modoboa New domain - Summary

Step 6: Setup DMARC and DKIM

After you add the domain, we will setup our DMARC and DKIM.

We will generate first our DKIM key.

Modoboa Generate DKIM

After that, click on the information icon.

Modoboa Generate DNS Information

Then the information will be displayed.

Map the remaining DNS records to your DNS provider.

If all goes well, it will look like this.

Modoboa Green

Step 7: Configure Email Clients

To send and receive emails, configure your email client (e.g., Thunderbird, Outlook, or mobile apps) with the following settings:

  • Incoming Server (IMAP):
    • Server: mail.example.com
    • Port: 993
    • Encryption: SSL/TLS
  • Outgoing Server (SMTP):
    • Server: mail.example.com
    • Port: 587
    • Encryption: STARTTLS
  • Username: Your full email address (e.g., [email protected]).
  • Password: The password you set for the email account.

Follow the images below if you want to configure with MailSpring using the settings above.

Add IMAP Mailspring

MailSpring Modoboa Setup Account

Modoboa MailSping Inbox

Step 8: Test Email Functionality

We will send a test email to Mail-Tester to check our deliverability.

First, logout from your admin account and using your email created, login.

Modoboa Email Login

Go to Webmail.

Let’s compose a message.

Modoboa Send Email

We got a 10/10!

Modoboa Mail Tester

Step 9: Secure Your Mail Server

Setup SSH keys: Using SSH keys is one of the most secure ways to authenticate and access your server, including your self-hosted email server. Follow my guide on how to generate and use SSH keys.

Enable Firewall: Allow only necessary ports (e.g., 25, 587, 993, 995) and block others:

sudo ufw allow ssh
sudo ufw allow 25,587,993,995/tcp
sudo ufw enable

Regular Updates: Keep your server and Modoboa components updated:

sudo apt update && sudo apt upgrade -y

Install Fail2Ban: It is a powerful tool that helps protect your self-hosted email server by monitoring log files for suspicious activity and automatically banning IP addresses that exhibit malicious behavior.

sudo apt install fail2ban

Troubleshooting Common Issues

  • Emails Not Delivered: Check DNS records (MX, SPF, DKIM). Ensure port 25 is open and not blocked by your ISP.
  • Cannot Log In to Email Client: Verify the username and password. Check Dovecot logs for authentication errors.
  • High Spam Score: Ensure SPF, DKIM, and PTR records are correctly configured. Use tools like Mail Tester to analyze your email setup.

Conclusion

By following this guide, you’ve learned how to purchase a domain on Namecheap, set up a server, install Modoboa, and configure it to send and receive emails. Modoboa’s user-friendly interface and automated installer make it an excellent choice for both beginners and experienced administrators.

If you encounter any issues, refer to the Modoboa documentation or seek help from the community forums.

2 Comments

  1. The most comprehensive guide I have searched for Modoboa Mail Server Setup. Can we use that steps to any VPS eg with 8GB RAM? Like Ubuntu, or CentOS? So many thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? Please solve:Captcha