This post may contain affiliate links.
You finally decided to buy a domain and have your website running. But now, should you run your own email server, or outsource it?
Should You Outsource?
There is no lack of free and really cheap email hosting services out there. For most people, using a free email service(i.e. Gmail) makes sense because it’s easy to use, and doesn’t require owning a domain. But, once you have a domain, you’ll most likely need to pay to send and receive emails with a custom domain. If you’re going to pay anyways, then the answer gets more complicated. Should you pay for a custom domain with a hosted solution, or do everything yourself?
In terms of cost, it’s pretty similar to host it yourself, or pay for a hosted solution. For example, the cheapest Gmail plan that supports using a custom domain costs you $5 a month per user. Running your own email server means you need at least a VPS(if not a dedicated server). At first, a VPS might seem expensive, especially if you’ve ever looked at WordPress VPS hosting. A lot of that price is for all the software such as cPanel, live kernel patching solutions, etc. You can get a VPS from a IaaS provider for much cheaper than WordPress VPS hosting(the cheapest I’ve seen is $15!).
The cheapest VPS I’d recommend for email hosting is Vultr’s $3.50 plan, but I’d personally stick with DigitalOcean’s $5 VPS(use that link to get up to 2 months free). The main reason for sticking with DigitalOcean is because you get more storage in their higher-tier plans for things such as email attachments. However, both providers do offer additional “block storage” for just $0.10 per GB, which can be used for storing email. Also, the price for the VPS and possible storage is the only cost you’ll encounter(aside from a domain). You can have as many email accounts as you want, without needing to pay extra per user.
Conclusion: For one user, it costs about the same, but you can still save with self-hosting. For more than one user, the amount you save increases rather fast(i.e. 1/2 the cost for 2 users, 1/3 the cost for 3 users, etc.).
The next thing to compare for hosted vs self-hosting emails is the features you get. Most hosted solutions give you some storage for attachments, webmail, POP3 and IMAP for other email clients, and SMTP so you can send emails from other email clients. They also include anti-spam, anti-malware, and some sort of filtering software(so you can send all emails with a specific subject to the proper folder, etc.). Some hosted solutions, such as Gmail, also offer video conferencing in their plans, but that’s outside the scope of actual email hosting.
The great thing about self-hosting is that you get to choose what features you want. I’ve yet to see an email feature only offered by hosted services which can’t be replicated on your own VPS. Sure, it might take some time to configure, but you can still get it done with some searching on the internet. For example, you can get SSL certificates for free from Let’s Encrypt which can be used for IMAP, POP3, and SMTP.
Conclusion: Hosted solutions and self-hosting provide the same features, but hosted solutions don’t require time to configure.
There really isn’t much of a battle here. Hosted solutions win by a landslide just because of their sheer scale. They have tons and tons of servers behind load balancers, and traffic automatically routes around servers that are down. While you can build a system like this yourself, it’s probably not worth it for anything less than a few dozen users($5 per user as opposed to $5 per server). It’s also quite hard to maintain multiple servers, and sync user data and emails across all of them. One thing you could do is containerize them and use something like DigitalOcean’s Kubernetes service, but that still takes a lot of time to initially set up. There’s also the problem of DDoS attacks, although this can be minimized with Cloudflare Spectrum which can protect non-web ports for services such as email.
Conclusion: Hosted solutions provide unparalleled reliability.
I’ve only listed three of the many things you should compare before making a decision. But, after looking at all the pros and cons, I’ve decided to self-host my emails. I’m already hosting multiple websites myself, so I was already paying for a VPS in the first place. Since I didn’t want to spend any extra money on a hosted solution, it only made sense to host emails on the server I already was paying for. If you’re already paying for even shared hosting with cPanel, you can probably host emails there. If you’re hosting your website on a VPS without cPanel, then you can also save some money by sticking with self-hosting. But, if you’re using a free hosted solution(i.e. Blogger) for your website, it might make sense to spend a bit more on hosted email.
If you do decide to host emails yourself, the next question is how to get that done. There are many options, but for the most part, you’ll need at least two pieces of software: one for SMTP, and one for IMAP/POP3 and email filtering. You can also throw anti-spam and anti-malware into the mix if you want to. The most popular software(i.e. what I use and have heard of) to run an email service is Postfix or Exim for SMTP, Dovecot for IMAP/POP3 and filtering emails, SpamAssassin for anti-spam, and ClamAV for anti-malware. On top of installing all of that software, you’ll also need to configure it.
Even if you’re just using a VPS for email hosting, I recommend you install VestaCP. All you need to do to install it is run two simple commands:
curl -O http://vestacp.com/pub/vst-install.sh sudo bash vst-install.sh
For more instructions, check the install page. Once VestaCP is installed, all you need to do is go to the mail tab, add a domain, then add as many users as you want. All the required configurations are done for you, and you can then access the built-in Roundcube webmail, or use your own email software via IMAP/POP3 and SMTP. If you want email filtering support(sieve), then follow this tutorial. To use a custom SSL certificate, simply follow this tutorial.
You can now (hopefully) decide if you should host email yourself, and how to do it should you decide to. Leave anything I may have left out in the comments.