Using Mailcow as a Mail Server

Julian B. Heuschen
Apr 10 · 6 min read

Have you ever heard of mailcow? I recently bought a new domain and wanted to set up a mail server. Having the choice between setting one up completely myself and using a third-party service, I ran over the docker-based mail server suite called “mailcow”.

Mailcow is a dockerized, seemingly easy to manage mail server suite. In this article, I want to write down my experiences from the first few months of using Mailcow, and finally come to a verdict as to what possible disadvantages of using it there are and whether they, in my opinion, are worth it.

The Installation

First things first, I obviously had to install Mailcow. The installation itself actually is pretty straight-forward. There are, however, a few prerequisites:

  • You need to have Docker as well as Docker Compose installed (as described on their respective websites)
  • As Mailcow comes with a fully-integrated Groupware, it can sometimes be quite resource-heavy. Many of these components can be disabled though and aren’t really necessary for the average user.

Having these in mind, we can start the installation by cloning mailcow-dockerized’s git repository (remember to use an appropriate directory for this — I personally use /opt/mailcow-dockerized/):

# git clone https://github.com/mailcow/mailcow-dockerized && cd mailcow-dockerized/

Once cloned, we can run the included generate_config.sh script to interactively generate the necessary configuration files. Finally, we can start mailcow the same way we do with any other docker compose project. That is, we run:

# docker-compose pull && docker-compose up -d

You should now be able to access Mailcow’s web interface by navigating to the hostname you specified during the config generation. In my case, I created a subdomain. You should be able to log in using the credentials (and subsequently change these).

Setting up a domain

Adding a domain

After changing your password, one of your first actions will probably be to add your domain. This can be done at Configuration → Mail Setup → Domains → Add Domain by simply filling in your FQDN — everything can be changed later on. Once you have done that, you can open the DNS dialogue to see what DNS Records Mailcow proposes for you to create / modify. In my case, I had already created most of them myself. Remember: Depending on your TTL, your records might take a while to become globally available thus enabling you to send and receive mails!

DNS Records as proposed my Mailcow

Having created all essential records, I also wanted to use DKIM. In order to do that, I had to navigate to Configuration → Configuration & Details → Configuration → ARC/DKIM keys and generate a key for the respective domain. Once you generated the key, go back to aforementioned DNS Records dialogue; a record (TXT) should now be visible. Once you created this record, DKIM should work.

Setting up Mailboxes

Adding a new mailbox

My next step was to begin setting up mailboxes. This is similarly straight-forward as is adding domains and can be done at Configuration → Mail Setup → Mailboxes → Add Mailbox.The upcoming dialogue asks you for a username (i.e., the email address’s left part) as well as for a password. If you have multiple domains, make sure to select the right one!

Sending and Receiving Mails

SOGo Groupware provides you with a webmail system

Thus far, we can already begin sending and receiving mails. You can do this either using SMTP/IMAP directly, or you can use the built-in groupware SOGo. As the former is probably self-explanatory (simply use Mailcow’s hostname as SMTP & IMAP server), I’ll go the second approach at this point. You can access your Mailcow’s SOGo instance at and simply login using the username and password you just chose. By the way: SOGo provides you with a synchronizable calendar and contact management, too. Furthermore, SOGo supports ActiveSync — that is, you can add your mail account as Exchange account and thus get immediate push notifications!

mailcow UI from a user’s perspective

Last but not least, not only administrators can log into the mailcow UI (the one where you just added mailboxes). Users can, too — and subsequently create temporary aliases for themselves, view quarantined mails, change their password, or adjust their spam filter’s sensitivity. Moreover, mailcow allows iOS/macOS users to download a configuration profile, automatically setting up their account.

Administrative Features

One thing I find great about mailcow is the sheer amount of administrative features we’re provided with. Amongst those are:

  • Aliases, Temporary Aliases & Domain Aliases
  • Resources (e.g., you can manage a physical room as a resource, invite it to calendar events, and thus see when it’s in use etc.)
  • Sync jobs
  • Filters & Address Rewriting (not unique to Mailcow but extremely easy to manage)
  • Multiple administrative users, as well as domain-specific administrative accounts
  • An extensive REST-API
  • OAuth2-Support
  • Automatic SSL Certificate generation and renewal

Updating Mailcow

A common task of all of us is to keep things up-to-date. With mailcow, we can easily do this by going to our mailcow directory and running:

# ./update.sh

The script will update configuration files and all docker containers (which may sometimes take quite a while). Sometimes, the update script itself has changed which will require you to run it twice (it will, however, ask you to do so). Important files are being backed-up beforehand.

Using Mailcow in a low-memory environment

I once installed mailcow on a development server with only 2GB of RAM and subsequently got into trouble with mailcow running out of RAM. In that case, you can drastically decrease mailcow’s RAM usage without affecting most of its functionality by disabling ClamAV and Solr in the mailcow.conf file:

SKIP_CLAMD=y
SKIP_SOLR=y

After restarting mailcow via docker compose, it should use much less memory.

My Experiences

I’ve been using mailcow for about a year and a half now and I’m altogether very happy with it. I’ve been using it for myself, as well as my family, and I haven’t had any notable difficulties nor problems. It simply fits my use case very well.

Additionally, something that I think is very positive is that mailcow is not only being maintained, but actively extended and developed. When I think back and compare the suite I installed about a year ago to today’s installation, there have been many newly introduced features in the meantime. Furthermore, the configuration is really straight-forward: most things can be done right-away using the administrative web interface — and most other things can be done via the central configuration file.

Disadvantages

In my opinion, the biggest disadvantage is the suite being so extensive. Most features I have never even used. For instance, mailcow comes with an XMPP messaging server, or a fully-equipped groupware. While there certainly are usecases for this, most of us probably won’t use them regularly. However, many of these services can be manually disabled via the configuration file. One thing that often annoyed me as a developer was the REST API not being especially well-documented. I have to admit, though, that this has gotten much better lately with a documentation being worked on.

My Verdict

I think that Mailcow is a great mail server suite, though not for everyone. For someone like me who is not focussed on mail server administration, mailcow is a really great way of having an own, fully-equipped mail server without having to spend endless time finetuning its configuration. There also is a community in which you can get support. I think, though, that there also are those of us who rather want to “manually” configure their server and have absolute control over their system. While it is possible to do so even with mailcow, it is probably easier to not use mailcow in that case.

CodeX

Everything connected with Tech & Code

Julian B. Heuschen

Written by

Hi there, my name is Julian and I’m currently a student. I’ve been programming for about seven years and am mainly focussed on app development. WWDC20-Scholar.

CodeX

CodeX

Everything connected with Tech & Code

Julian B. Heuschen

Written by

Hi there, my name is Julian and I’m currently a student. I’ve been programming for about seven years and am mainly focussed on app development. WWDC20-Scholar.

CodeX

CodeX

Everything connected with Tech & Code

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store