So yes it’s 2020 – why would anyone wish to host their own mail server? You’re bound to have issues with sending mail given how much spam is out there nowadays. For a start how many residential/SME ISPs offer you the ability to have a static IP and PTR record? Not many. Factor in the requirement for correctly implemented DKIM, DMARC and SPF records, and you’ve probably lost the will to continue on your quest.

I could bore you with the detail on all the above, but this page explains the main technical requirements to setting up a trusted SMTP server.

I should throw caution to the wind at this point, emphasising that if your email is business critical, I would suggest it warrants a well run, secure cloud-managed service (even if that’s one of the many free options out there). However, if you’re a self-confessed geek and just interested in learning more about an often taken for granted technology, then the above link is worth a read. If you have no idea what an SMTP, POP3 or IMAP server are, then this article is also worth browsing to build an understanding of email’s foundations.

For me the answer to why you’d want to ‘self host’ was simple – I had an excellent network attached storage (NAS) device (a Synology DS918+) doubling as a powerful home server with copious amounts of storage and a robust data integrity/backup system. I wanted to have my own domain name after the @ symbol, as well as the satisfaction of better understanding a technology I used everyday. It seemed logical to leverage the NAS to also host my email without having to pay a monthly subscription for a custom email service.

Of course there are easier ways of getting a custom domain email, not least Zoho’s free service (I believe at the time of writing this is one of the only free options out there, but it’s only free for one alias/user). However, Zoho didn’t offer enough storage (only 5GB), and besides, where’s the fun in that?

The learning curve started by reading up more on SPF, DKIM and DMARC. However, not having an ISP that offered PTR and a static IP, I swiftly decided to cheat, opting to use a free SMTP relay service. There are several out there that you could choose, but I chose to go with MailGun (simply because it offered one of the largest free monthly email quotas).

A relay service avoids the requirement for setting up a PTR record, as well as handling SPF, DKIM and DMARC for you (note you still have to add some DNS records, so you will need access to your domain’s DNS Zone editor). I also forked out a hefty $9.99/year for’s ‘Email Store/Forward’ service. This effectively provides partial redundancy for when your SMTP server goes down, the service re-sending any failed message sent to your server for up to 30 days. The other benefit of Dynu’s service is that it helps mask the IP address of your mail server (adding another layer of protection – if implemented well).

Note an ‘Email Store and Forward’ service is not necessarily essential – a lot of SMTP servers now keep re-sending email for a period of time which should accommodate any short term loss of service your end (for example your ISP loosing service for a day or so). However, it’s nice to know you still have something capturing any emails for 30 days if your server does go down. Of course it’s not full-redundancy, as if you only have one mail server and that goes down, you won’t be able to access your mail. However, when it does come back online, any backlogged email should start flowing through again.

There are ways of setting up a failover mail server. However, if you only have one internet connection and it’s your ISP that’s lost service, you’d need to be hosting the failover server offsite. This then begs the question, if your internet service is down, how will you access this offsite server? Ok, you could fall back on the mobile networks (if you’re lucky enough to have a good signal), but for the average person who can live with a small amount of downtime, it should be sufficient to know that any emails in that time are still being received for later viewing once service resumes.

One final point to note is the dreaded GDPR – both Mailgun and Dynu are US based companies – hence GDPR compliance is a grey area (but arguably no greyer than using one of the many free US based Cloud Email Services). Mailgun Technologies, Inc. is listed on the US Privacy Shield list but I can’t find Dynu Systems. Hence if you’re sending personal information through these services, you will want to get some legal advice/seriously consider if this ‘self-hosting’ is worth it.

If I haven’t put you off yet, you should be able to end up with a custom domain email service with pretty much unlimited storage, that can use multiple aliases/users for just $9.99/year. Compare that to Zoho who charge (at the time of writing), £38.40/year per user for just 50GB storage, and you can begin to see why this might appeal to some. Admittedly, this doesn’t include the cost of the NAS, the NAS hard drives, NAS backup services, or power. However, for me at least, these are services I would be paying for anyway – the Zoho service being an additional cost on top. There’s also no reason why you couldn’t use a single board computer (such as the Raspberry Pi), configured with a mail server and an external hard drive, for a fraction of the cost of a NAS.

In my next post I’ll go into more detail on the steps I took to set this all up, starting from the basics such as dynamic DNS, port forwarding and initial mail server setup.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *