77 points · by tambourine_man · 12y ago · 27 comments
The simplest self-hosting solution I've found is to setup 2 cheap VPS servers that accept mail via postfix (128mb, maybe 256mb if you want to virus scan at this point, a good idea), and they both can deliver email to an in-house server running roundcube or zarafa or whatever, when the internal server is up and running. As long as the VPSes are up, they hold email until the server inside your local network is up and running.
This means you bypass the very messy "secondary mx" issues, as you only have one internal server to worry about that accepts email arbitrarily from the 2 public server, and you can backup your internal server just like a normal PC.
I had a similar setup for a while, and it was interesting to see that some messages (spam, mostly) picked the secondary MX by default. Spam servers also seemed to cache the (secondary) MX for much longer than the TTL.
Incidentally, if you are trying to read email or send email with code, having your own email server, working with a desktop client is a very useful starting point. You can downgrade the spam filtering, the SPF record checking, the SSL/TLS sign on until you have something that can read IMAP or POP. This is where the real fun begins as emails come in various multi-part formats, there are lots of character sets to translate to UTF-8 and there is base64 to deal with. If you can reliably read the header of an email and extract something simple like the date then you are doing very well.
It also does very good if not excellent job at illustrating how hard it is to set up, secure, and maintain your own email service. There are lot of places to go from here, including multiple MX'es, backup/recovery, etc.
Nevertheless. I've been using my own email infrastructure for almost ten years years. For last four I'm totally over it. Yes, there are some things to do if you absolutely want to be free to chose your email provider whenever you want to - having clear choice where to go, having backup off service provider, having migration strategy in place, etc.
Email servers don't have to be complex. I wrote an SMTP and POP server in a single afternoon in the late 90s. The protocols have lot of optional parts, and if you want to get something quick up and running, there are simple implementations possible. The standard Unix servers are quite complex to administer but that's mostly because they were built for Unix system administrators. I mean, BIND configuration files are also complex, but that doesn't mean we should throw out DNS just because it's not trivially simple to implement.
The only point to reinvent and reimplement everything is if you can make some revolutionary improvement, otherwise, we should just improve what we have.
No, we do have this capability: use XMPP.
In fact, XMPP is functionally enough to completely replace email, and does also serve as IM.
The reality is much more of a mess, with multi-device issues -- routing issues -- federation issues, not to mention a ton of non-XMPP messaging services.
Another issue is number of tools and skills we need to implement email server locally, which I suspect is a result of same specifications, protocols and formats.
I am no expert on this (not a real one anyway) but there has to be a point when effort to support a system outweighs convenience?
Other than that, I still don't see what your criticism actually is.
All of that is not to say that the email protocol stack is somehow particularly elegant (it most certainly is not), but most often when you hear people say that we need to reinvent email, they don't actually understand what the problems with email are and just seem to think it's bad because it's old--all while being completely oblivious of the lessons that have been learned with email. Despite its lack of elegance, it does actually incorporate a lot of wisdom, as well as its fair share of stupidity.
But what tends to be overlooked in particular is that for quite a few of the most obvious problems with the usability of email (namely, authentication of senders and spam), those problems are not problems that the people who invented and extended the protocols and formats failed to consider, but that despite a lot of effort and intelligence applied to them, they failed to come up with a solution for. And the reason for that tends to be that those problems are fundamental social problems that just crop up in email just as they do elsewhere, which can not be solved by simply inventing "modern email".
As for how difficult it is to set up your own mail server, I don't really have a clue. I mean, I do it all manually, but that's probably just because I learned how to do it quite a while ago, and now that I know how to do it all manually and I have a working setup anyhow, I don't know what easier ways might be available. But in principle, I don't see why it shouldn't be possible to put together a package of a pre-configured mail setup for standard cases which shouldn't be all that difficult to deploy. I mean, if you look at how many magnitudes more awful the web stack is, and ordinary people still manage to install and use a web browser, completely oblivious to the hilarious complexity of that piece of software.