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.

mailcow
hetzner

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.

1

Prerequisites

  • An Hetzner account
  • A terminal to access the server
  • A domain with write access to the DNS records
2

Create a new Cloud server

EASY~10MIN}
  • 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 around Ubuntu 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.

3

Setup DNS

MEDIUM

Verify your DKIM

dig +short example.com TXT dig +short dkim._domainkey.example.com TXT
4

Bonus: add your mailbox to your mail client

EASY~10MIN

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