Self-Hosting Email

Written By: Jake Bauer | Posted: 2020-05-16 | Last Updated: 2020-05-16

I just finished setting up self-hosted email and it was the easiest thing ever.

As I discussed in my previous blog post, I set up a VPS with Vultr running OpenBSD (that’s a regular referral link, this one will give you a $100 credit). Following this guide from one of the developers of OpenSMTPD (I think he may be the creator), I was able to get the server up and running in less than two hours while understanding every step and every configuration option along the way. None of it felt like the black magic that it was made out to be by many on the Internet.

To test the setup, I created the email address me@jbauer.ca and set up Thunderbird. I tested sending and receiving emails and checked, using Wireshark, that my mail was being correctly encrypted with the TLS certificates I configured:

A screenshot of both of my
    monitors with Neomutt, Thunderbird, Wireshark, SSH, and Firefox with Vultr
    open while testing if email is working.

I also used MXToolBox.com to test that my mail server and DNS records were correctly configured. This service was invaluable since I can’t test Port 25 connectivity to the mail server from my residential connection.

A screenshot of MX ToolBox
    results with all green checkmarks.

As of yet, I haven’t had much trouble getting my email delivered to different addresses from Big Mail Corps which was what I was most worried about and which is an often-cited factor many use to advocate against self-hosting email. So far, I’ve confirmed that both Gmail and ProtonMail deliver my mail. Microsoft’s Office 365 marked my IP as being spam—which is understandable since it’s a brand new mail server on a previously-unused domain—but not only did they notify me that I was put on their spam list, they offered a really easy way to remove my IP from the list:

A screenshot of the Office 365 Anti-Spam Delist Portal showing all
    green checkmarks.

I didn’t bother setting up virtual mail accounts because it will just be me using this mail server. If there are additional addresses I need to add, I can just add them to the /etc/mail/aliases file. If you want to set up your own mail server and wish to use virtual mail accounts, this tutorial from Vultr discusses that.

Some more things that I have to look into doing are setting up a backup mail server in the case that mine experiences downtime, and setting up Rspamd training using Dovecot as suggested at the end of the guide which I followed. This whole experiment has also given me the opportunity to experience administration of an OpenBSD system, which I’m enjoying so far. The manpages have been excellent and the system is laid out in a really straightforward way. There are a few things that I need to learn and get used to such as pf instead of nftables for packet filtering, rcctl instead of systemctl for managing services, and other little things that are OpenBSD-specific.

Now that I’ve done it, I can heartily recommend giving self-hosted email a shot. It’s nowhere near as difficult and scary as it’s made out to be and it rewards one with control over one’s email data and infrastructure. I don’t see how hosting an email server will be any different than something like a Web server or Matrix server in terms of workload given that all one has to do once it’s set up is standard system administration tasks.

This is my twenty-first post for the #100DaysToOffload challenge. You can learn more about this challenge over at https://100daystooffload.com.