Maddy is a mail server written in Go that aims to be simple, fast, and easy to use while providing advanced features such as SpamAssassin integration, SMTP authentication, and more.
This tutorial will guide you through the process of setting up Maddy on Debian Latest.
Before we get started, you should have:
Maddy is written in Go, so we need to install the Go programming language first.
Update your system's package list:
$ sudo apt update
Install the golang
package:
$ sudo apt install golang
Clone the Maddy repository from GitHub:
$ git clone https://github.com/foxcpp/maddy.git
Change into the maddy
directory:
$ cd maddy
Build the Maddy binary:
$ go build
Move the maddy
binary to /usr/local/bin
:
$ sudo mv maddy /usr/local/bin/
Create a new configuration file for Maddy:
$ sudo nano /etc/maddy/maddy.conf
Copy and paste the following configuration into the file:
log_file = "/var/log/maddy.log"
[submission]
bind = ":587"
auth = "on"
starttls_only = "yes"
[mx]
bind = ":25"
relaying = "permit_any"
This configuration configures Maddy to listen on port 587 for submission (SMTP with authentication) and port 25 for incoming messages (MX).
Save and close the file.
Create a log directory for Maddy:
$ sudo mkdir /var/log/maddy
Set permissions on the log directory:
$ sudo chmod 755 /var/log/maddy
Create a user and group for Maddy:
$ sudo useradd -r maddy -s /bin/false
Set permissions on the Maddy binary:
$ sudo chown root:maddy /usr/local/bin/maddy
$ sudo chmod 750 /usr/local/bin/maddy
Add an A record for your domain name that points to your server's IP address.
Add an MX record for your domain name that points to your server's A record.
Start the Maddy service:
$ sudo systemctl start maddy
Enable the Maddy service to start on boot:
$ sudo systemctl enable maddy
Send a test email to your server:
$ echo "This is a test message." | mail -s "Test Message" yourname@yourdomain.com
Check the Maddy logs for any errors:
$ sudo tail -f /var/log/maddy.log
If everything is working correctly, you should see a message similar to:
2021/12/01 12:22:11 [smtp,maddy.domain.com:587] 220 maddy.domain.com maddy ESMTP (Maddy)
Congratulations! You have successfully installed Maddy and configured it to send and receive emails on your domain.
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!