Open Source Mail Server Maddy Deployment Tutorial
Before I introduced a complete email service RainLoop, this time we introduce another open source mail server Maddy. Maddy is written entirely in Go language, which is lightweight and easy to use.
Next, I will introduce to you how to use Maddy to build a personal email server.
In general, refer to Maddy’s official website and it can basically be built. If not, you can refer to my tutorial
Apply for an SSL certificate
Download and get
Deploy the SSL certificate
First rename the downloaded certificates to
privkey.pem, and transfer them to the
/software/email/maddy/certs/mx1.yourdomain.com/directory of your own server
Modify the Maddy configuration file
Take the maddy.conf file from github, transfer it to the
/software/email/maddydirectory and modify the content of the configuration file, replace with your own domain name
$(hostname) = mx1.yourdomain.com $(primary_domain) = yourdomain.com
docker start maddy
docker run \ --name maddy \ -e MADDY_HOSTNAME=mx1.yourdomain.com \ -e MADDY_DOMAIN=yourdomain.com \ -v /software/email/maddy/certs:/etc/maddy/certs/ \ -v /software/email/maddy:/data \ -p 25:25 \ -p 143:143 \ -p 587:587 \ -p 993:993 \ -d foxcpp/maddy:latest
If the server pulls the docker image too slowly, you can pull it locally and then package and upload it to the server. I won’t go into details here. The key commands are the following two.
docker save --output busybox.tar busybox docker load --input busybox.tar
Go to the background management interface of the server manufacturer to configure DNS
; Basic domain->IP records, you probably already have them. example.org.A 10.2.3.4 example.org.AAAA 2001:beef::1 ; It says that "server mx1.example.org is handling messages for example.org". example.org.MX 10 mx1.example.org. ; Of course, mx1 should have A/AAAA entry as well: mx1.example.org.A 10.2.3.4 mx1.example.org.AAAA 2001:beef::1 ; Use SPF to say that the servers in "MX" above are allowed to send email ; for this domain, and nobody else. example.org.TXT "v=spf1 mx ~all" ; It is recommended to server SPF record for both domain and MX hostname mx1.example.org.TXT "v=spf1 mx ~all" ; Opt-in into DMARC with permissive policy and request reports about broken ; messages. _dmarc.example.org.TXT "v=DMARC1; p=quarantine; ruf=mailto:email@example.com" ; Mark domain as MTA-STS compatible (see the next section) ; and request reports about failures to be sent to firstname.lastname@example.org _mta-sts.example.org.TXT "v=STSv1; id=1" _smtp._tls.example.org.TXT "v=TLSRPTv1;rua=mailto:email@example.com" default._domainkey.example.org.TXT "v=DKIM1; k=ed25519; p=nAcUUozPlhc4VPhp7hZl+owES7j7OlEv0laaDEDBAqg="
Create a new user
docker exec -it maddy sh maddyctl creds create firstname.lastname@example.org # Password will prompt you to enter yourdomain maddyctl imap-acct create email@example.com #
The above is the simple tutorial I summarized about using Maddy to build a personal mail server. Welcome to support this Go open source project.