Mailserver setup

My apologies if this post is too offtopic - please let me know and I will delete it!

I have gotten a notification from my web hosting provider with yet another price increase. So I figure it is time to start looking for another solution. For my websites I will be looking into hosting them on a VPS - I have a Nanode (1 CPU/1 GB RAM/25 GB Storage) that is not being used and I can beef that up.

But what about mail? Running a mailserver is not trivial, and then there is the issue about outgoing mail being flagged as spam - has that been solved with SPF, DKIM and DMARC or does one still need a front?

And what wold be a good backend? While I am not a fan of Windows as a server OS, Exchange is a strong product especially the integrated mail + calendar + address book in the “package”. I can get a Windows Server 2022 license either Standard or Datacenter for under USD 50 and a 2022 RDS CAL license for around USD 35 but I am not sure this is enough? I would run this as a VM in Proxmox

There is a lot to this. It’s not too hard to set up a mail server, but deliverability can be a real struggle.

If the topic is of interest, Michael Lucas just released a new book called Run Your Own Mail Server, which (like all his books) is a great read and pretty in-depth.

I’ve been hosting my mail server for years using the mailcow docker project, having migrated to that from a more manual set up.

Not getting mistaken for spam is the real issue. At a minimum you’ll need an IP address with a clean reputation, but the big email players (Google, Microsoft, Apple) may decide to arbitrarily not deliver your mail and there’s little to be done. When I was first getting set up, I consulted mxtoolbox.com often to make sure I wasn’t missing anything that might land me on a blocklist.

On the platform side, in my case I have mailcow running inside a Proxmox LXC on a VPS.

Now, having said all that, if you’re tired of your provider’s prices, there are other fish in the see that may be worth checking out. At my business I use Zoho, which has been pretty solid and I’ve heard decent things about fastmail, too.

I think consensus on the topic is that while it can be done and if you follow all the best practices you will very likely have a functional setup, you can also end up being put in people’s spam folder due to no fault of your own. You are in many ways at the mercy of a few big tech companies and the smaller you are the less of chance you have to get through to them.

Personally I recently moved to Migadu after some years with Proton mail. I like Protons mission, but I wanted something closer to running my own (no restrictions on amount of domains, mailboxes etc) setup. Super happy with them and they’ll be the ones that have to tell Google or Microsoft to f themselves if they decide to block their IP-block.

If anyone is curious I wrote some more detailed thoughts on why I moved from Proton to Migadu.

1 Like

I hadn’t heard of Migadu before. Sounds like a pretty cool option.

I can give a +1 for Migadu, I have been using them for a few years and they have been rock solid.

It is certainly possible to host your own mail if you’re a thoroughly technical person. You just need to be aware that you’re walking into a war zone when you do. It’s not something you set up and then you’re done with, it’s at best a simmering dumpster fire, and you’d better be keeping an eye on it.

As others have mentioned, running a real mail server is a full time job.

I can recommend mxroute for email - I just renewed for another 3 years & have been with them for 5.

Migrating mail to their servers can be done with imapsync - I would pick up one of their 3 year Black Friday deals which are usually very good - there is also a lifetime deal if your mail volume is low (under 300 messages an hour).

A good backend for a 1gb RAM VPS would be Alpine Linux - years ago I happily ran a mail / web / database server all on 1 core / 256mb RAM. Nowadays I run MicroOS from opensuse on all my servers (replacing Debian / Ubuntu which I ran for about 5 years) - the RAM usage is about the same & I never have to reinstall (MicroOS is a “rolling release”) - in almost a year I have had zero issues. The hosts all reboot in about 5 seconds every 1-2 days to apply security updates (see rebootmgr && transactional-update). The ability to create custom iso images for MicroOS is great - you boot from the iso & MicroOS installs itself.

On my servers I configure Postfix as a Smart Relay => mxroute. I’ve also done it previously with Exim. Nowadays I run my relays “rootless” (unprivileged) under podman in 2 locations & configure MX records (in an internal domain) for High Availability. I also run netbird to connect everything together over wireguard so I don’t expose my infrastructure to the internet. Running your own authoritative DNS server (for your custom MX records) - is also quite easy with Knot DNS (which I also run under podman) - it has a shell for adding DNS entries which is nice. For high availability I keep the primary DNS on my workstation which updates 3 x remote secondaries configured to write zone files - again running securely over netbird.

As you use Proxmox - you may find distrobuilder-menu useful for building custom LXC images.

Do not try to run a mailserver on a residential IP.

Most ISPs block port 25 outbound nowadays anyway and unless you’re in an extremely rare minority you don’t have IPv6 for the last mile ISP, which is required for email these days.

I’ve been running my own mailserver on a Nanode for the past year and it’s been mostly fine. You’ll have to request their support unblock the mail ports if you go with Linode.

I will warn you, you will have some headaches. Microsoft blocked all of Linode from emailing their free tier accounts for months on end. And just this morning I noticed that the Linode ipv6 block got listed on Spamhaus, which resulted in a bounce from a mailing list.

1 Like