HACKER Q&A
📣 psychoslave

Are you aware of a sane path to selfhosted email server?


Granted one own a domain name, what are the knowledge required to selfhost an email server and migrate to that solution? What are the pros and cons?


  👤 bravetraveler Accepted Answer ✓
Pretty much anything you'll find recommended can receive mail fine. Consistently delivering it is another job you/I, and most people, probably don't want.

Maybe that Super Important email you sent got delivered. Maybe it didn't. If not, maybe it bounced. Maybe it didn't, and so on.

Life generally doesn't get easier adding services to admin. Especially one as trusting, yet not, as email. IP reputation, blacklists, whims of some remote greybeards, etc.

I've done it before and it went well. Then it didn't and I took stock. Entirely not worth it. Dedicating time to decorate and maintain a trash bin.

All told: I'm entirely happy to pay someone else to host this. I put my sensitive stuff on services I run that are also easier to get consistency out of


👤 steampilot
The struggle against spam has led to a situation where large companies hold significant control, ostensibly to prevent spam. Yet, despite these measures, the spam issue persists, and the complexity of hosting one's own email server has increased substantially.

Maybe it's time we moved on to a different protocol?


👤 dxld
I've been really impressed with Mox, an all-in-one monolithinc mail system written in go: https://www.xmox.nl

Trivial to setup, guides you through configuring SPF, DKIM, DMARC, MTA-STS, DANE and DNSSEC. Handles certificates by itself through ACME, comes out-of-the-box with IP/domain reputation based and bayesian spam filtering.

While I've come to appreciate how much tweaking you can do with something like exim I'm starting to see the advantage of not having to spend time doing any of that :)

Mox also has some really cool (and AFAICT) novel features stemming from the fact that it's so tightly integrated. Have a look at the "Rejects" mailbox, or the nuanced way it rejects spam at SMTP time to prevent the dilemma between causing backscatter or potentially dropping mails (like gmail likes to do). I've also never heard of REQUIRETLS before seeing it exposed right there in Mox's built-in webmail.


👤 bhaney
I've been self-hosting my email for over 7 years now. Just threw postfix and a couple standard milters on the smallest digital ocean droplet (so it would have an IP with a good reputation) and let it go. Had some deliverability issues to microsoft mail services at first but went through a support process that took care of that. Never had any other issues.

If you aren't familiar with postfix it can be a pain to setup correctly, but I think there are a bunch of mail server software bundles these days that make the process a lot easier.

Pros: I make pretty extensive use of aliases (every service I give an email address to gets a different one) so it's nice having such fine control over where emails are routed, but mostly I just like not needing to rely on a mail provider.

Cons: Small ongoing cost and initial setup efforts, but no extra effort once it's setup - I haven't had to do any management work on the server in years.


👤 bosch_mind
Did this for several months. People over talk about how hard it is with no experience doing it. Honestly, it’s a piece of cake.

The downside is that it’s time consuming because like any system, you must maintain and update it.

I self hosted mailcow on a VPS with a service similar to sendgrid and Postmark (forgetting the same now) for outbound email to avoid the blacklisted IP problem.

For inbound routing, I used Cloudflare DNS and setup aliases in Mailcow (nice UI). You can use any client you want against your mail server. It’s just an IP and a port (or domain).

I did it for awhile because I was already selfhosting a lot. However, 6 months in I was like.. I need to go outside, I’m tired of debugging mail problems. Back to Gmail. Maybe there is a happier middle ground


👤 Irongirl1
I own domain names, but I'm not smart or techie enough to do it myself.

I found Modoboa: https://modoboa.org/en/ and when I finally do it and if they are still around, I'll probably go with them.

HTH


👤 beefnugs
If you want to pay a bit for easier, I have recent experience with Axigen. Still getting updates, web based configuration, bare bones debian 11, updating a couple times a month with 5 command lines, and you need to know how to do backups (use kopia)

👤 atmosx
Use openSMTPd with any imap client. Use clamav. Make sure you properly setup SPF, DKIM, DMARC. Make sure the static IP is not in one of the public lists.

👤 yownie
Docker-mailserver

docker-mailserver.github.io/


👤 brudgers
In my time on HN I have read what I consider a non-trivial number of informed opinions regarding self-hosting email.

To me, as a hobby is a perfectly sane reason. As a business decision, is generally madness (the exception being businesses where external email servers would be a legal or security issue).

The problem is most ordinary email is accepted via whitelist. So general communication is not just difficult if you have your own email server, it's difficult if you pick an "off-brand" email provider for your business.

Ask me how I know. I'm glad you asked.

Back in 2007 I launched my architectural practice. Because selling was hard, I spent my money buying a domain and time building a website. I used GoDaddy because I had heard of it (and for context it would be a couple of years before I heard of Python). My domain hosting came with email hosting as well.

In 2010, I had a client who couldn't get my emails. An important client. I thought it was a Godaddy problem. But I'm pretty sure it wasn't. I believe their email server was configured to reject everything from GoDaddy IP addresses.

Why? It was a small power co-op. Critical infrastructure. As best I can tell they outsourced Exchange Server management to a local IT consultant. The IT consultant followed best practices because that was easy. And I was just another vendor and my email was my problem. It would be ridiculous to expect my client to lower their security for my email problem.

migrate to that solution

Self-hosting email is probably not a solution. Good luck.


👤 t312227
hello,

as always: imho ...

self-hosting email [among other services :] i've done this since ... ever ;))

pros: done properly, you learn a lot about various fundamental aspects of modern computing and (inter)networking.

if this is something you are interested in - go ahead!

[if you just want email using your own domain: pay someone a few bucks a month and do whatever else matters to you!! ;]

cons: takes some of your time ;)

possible path:

1. do you have experience in selfhosting anything!?

if not: start with selfhosting a shell-server - ssh ... to access your system - and a (simple) webpage ... static html-pages, PHP using apache2 or nginx.

why? its simpler / a lot less "moving parts" compared to email and you familiarize yourself with some basic services which are also necessary for email selfhosting

* DNS ... eg - THE basis of all [other services] of the internet: whats a SOA, a A record, howto manage serials in a sane way, whats an MX record!? how does a [RFC-conform|"best practice"] zone-file look like!? why following "best practices" make sense!?

* operate a [linux|*BSD] system over a longer timespan

don't even think about using windows or macOS X for this, its not worth the time / hazzle!!

* howto automate details of the systems installation and operation

2. if you know howto do this, then read about SMTP and the various components which form an email-system

you need

* DNS - as i said before, this is the fundamental service for all other services on the internet

* the MTA - at the core

* MDA - you want to access your mailbox

* mail-clients - from webmail to various clients on your devices

* (somewhat) optional: content-scanners - spam, virus, rbls

content-scanners are not necessary for a "playground" system, but they are for a "serious" system ...

ad "playground": use some kind of a "less serious domain" at first, because you will encounter problems.

watch/monitor/backup your system - you will encounter "other problems" over time / if you operate your selfhosted system long enough :)=

a word about where to host such selfhosted services:

i'm a big fan of "bare metal" device, they are "more fun" but a bit pricier than cheap vhosts ... but often cheaper than some "services with a fancy name" from a "big cloud-provider(tm)" ...

regardless if its a cheap/older root-server at some hoster ... or some cheap vhosts: they should have enough resources for "playing around".

if you are able to get your own fixed line with "real" addresses somehwere - no CGNAT, you don't want to fumble around with access-tunnels at first -, operate your own hardware ...

just get yourself an old PC/laptop you already own, a beefier raspberry pi [2/3/4/5] or some cheap ITX board with a pre-installed CPU adding "yesteryears" memory-sticks from your closet. you don't need much!!

and this so much more fun than clicking around in the "big cloud-provider(tm)" admin-webapplication and pay a ton of money each month ;))

just my 0.02€