DevOps
Own your email server by setting up a Mailcow server on a Hetzner machine
Run your business email accounts on your own server and avoid privacy related issues of using cloud hosted solutions, not mentionning the substantial price saving and the unlimited accounts number.
You can run your business email accounts on your own server and avoid the privacy related issues of using big tech's solutions, not mentionning the substantial price saving and the unlimited accounts number. There are a few discouraging arguments not to host your own business email server:
- You'll have to install, maintain, upgrade and backup your own server
- You'll have to ensure both your domains and server IP's reputation in order for your messages to be delivered. The out of the box bad reputation that will keep your important emails dangling between your outbox and the customer's inbox.
In this tutorial we will:
- Create a server and run Mailcow
- Link your server with your domain's DNS records
- Optimize your installation's reputation
This tutorial forks the official Hetzner tutorial.
Prerequisites
- An Hetzner account
- A terminal to access the server
- A domain with write access to the DNS records
Create a new Cloud server
-
Sign-in to the** **Cloud Console
-
Create a new project and name it
-
Choose a server location and type depending on your needs
-
Click**
Add Server
and select your server image. This tutorial is based aroundUbuntu 22.04
but can easily be adapted to **Debian 11
, which is more stable and lighter. -
Choose the resources you need from Type
-
Click on the field**
Cloud config
enter this:#include https://get.docker.com
**(this will install docker) -
Select your SSH key
- You can read** this article **to learn how to generate an SSH key
-
Write your server hostname in**
name
**input (mail.example.com) -
Click Create and buy now
How to choose the correct server location and type
Choose a server location which is geographically closest to you or your user base. In regard to the correct server type, keep in mind that Mailcow requires at least 7GB RAM to function properly. Mailcow is a fully-featured groupware solution. Having that said, the lowest server type available would be a CX31* or CPX31.
Setup DNS
Verify your DKIM
dig +short example.com TXT dig +short dkim._domainkey.example.com TXT
Bonus: add your mailbox to your mail client
IMAP email address password mail.example.com mail.example.com
Mail server blocked from sending https://docs.hetzner.com/cloud/servers/faq/#why-can-i-not-send-any-mails-from-my-server
https://datatracker.ietf.org/doc/html/rfc5322
Reputation
Reset your reputation
https://csi.cloudmark.com/en/reset/
(https://community.mailcow.email/d/521-delivery-problems/3)
Inspirations and references
- https://raslasarslas.medium.com/how-to-deploy-sentry-on-a-kubernetes-cluster-using-helm-600db31d4486
- DKIM with DNSSimple: https://support.dnsimple.com/articles/dkim-record/
- Dmarcian
- https://www.mail-tester.com/spf-dkim-check
- Troubleshooting
- If you want to read more about the technical details of DKIM, head over to DKIM.org http://www.dkim.org/.