Self-Hosting My Email

2023-07-16 • 4 min read • Tags: Comp Sysadm

While many give up on self-hosting their email1, I actually just started self-hosting mine.

Why

Because Gandi, a long-time trusted french registrar and web hosting provider, recently changed direction and is basically forcing me out.

I’ve been with Gandi since 2010-09-11, when I registered my first domain. But it wasn’t until 2013 that I actually started using their email service.

I quit Gmail officially on 2019-08-21 for my own domain email addresses, effectively setting up an auto-reply on Gmail2. Before that I was slowly ramping up since late 2017 though.

On 2023-06-13 I received the email from Gandi announcing that their email service, previously included with a domain purchase, was now going to be charged (€57.48/year). But there were previous signs as announcements from Gandi began earlier in other regions than mine.

It’s only then that I realized email was not usually part of the package for a domain registration, as I thought was the norm back in the 2000s. 🤔

The jump

Alarmed by these early announcements I started looking for alternatives, seriously considering self-hosting my email, as I was already close to make the jump early 2018. What had kept me off was not finding any secondary MX partnership, a fallback to hold my email in case of incident or maintenance.

So I started dusting off my incomplete email setup, although still worried that I wouldn’t be able to find any friendly secondary MX3.

That’s how I looked closer into CHATONS (kittens in french), a “collective of small structures offering online services”, a sort of Community-Supported Hosting. I was hoping to find some small organization that would accept to host my email intermittently. And I found one!

La Contre-Voie (“opposite track” in french, abbreviated LaCV here) advertises that members can use their own domain for the email service 🤩. Membership starts at 10€ for natural persons and donations are accepted. Some of the attractive characteristics I noticed include: founded by students of the prestigious 42 school, appealing design of their website (especially compared to other CHATONS orgs), judicious choice of hosted services.

Interestingly enough they also make their internal documentation publicly available. That’s how I learned about their use of docker-mailserver, which turned out to be an invaluable source to complete my own setup 🙏🙏🙏

Technically, apart from the mail server configuration itself (which I won’t detail here as it’s heavily inspired by docker-mailserver), it was mostly about DNS manipulation. After completing my registration, we agreed with LaCV on the following process:

  1. Usual procedure to add my domain to the LaCV email infrastructure. MX (which I control) don’t point to LaCV servers just yet, or only with low priority.
    • This requires an initial DNS setup from my side: MX, DKIM, SPF, DMARC.
  2. Quick tests of the delivery to LaCV servers by some kind of aliasing on my server (which has higher priority based on MX entries) — actually postfix transport table.
  3. Finally, if not done already, add LaCV MX.

What happened in practice is that, while I was tuning my email server, it became unavailable for maybe half an hour. Fortunately incoming email was properly redirected to LaCV which proved the effectiveness of the fallback \o/

Final step

I am leaving Gandi 😢 and will transfer my domain to another registrar. When starting the transfer process on the web dashboard, they have a nice popup warning about losing your existing mailboxes. And I actually had forgotten one. After creating the account on my end and syncing both accounts with mbsync, I went ahead with the transfer. I’ll write about that when the process is complete.


  1. https://news.ycombinator.com/item?id=32715437 is one example but I remember reading a couple of similar posts in the last years. ↩︎

  2. The reference is an archived email to test the Gmail auto-reply. ↩︎

  3. Self-hosters rightly pointed out since that while it’s generally easy to collaborate on DNS, email poses trust and privacy risks. ↩︎