Running my own mail server

Fri 30 August 2013

If you follow Hacker News, you probably saw a spate of articles in the last few weeks tutoring users how they can set up and run their own mail servers. It wasn't a co-incidence that this was following the whole NSA surveillance leak, as a good number of these articles touted privacy as the primary reason why you would want to do this. Regardless of the absurdity of this argument (and the futility of your efforts), I took this opportunity to learn something new. In short, my own mail server running on a cheap VPS has been successfully receiving mail for for over a month now.

Here's how I did it:

  • Get a dedicated VPS instance - LowEndBox is a great resource for this. I got a nice slice for <$5/month.
  • Install Debian/Ubuntu/ on it
  • Install iRedMail on it
  • Enjoy!

It's really that simple. iRedMail makes it dead simple by aggregating various services such as Dovecot, PostgreSQL, SpamAssassin and ClamAV in one package. It even provides an out-of-the-box webmail interface through RoundCube. It literally takes about 15 minutes to set up and once your DNS changes go through, you should be able to send and receive email right away.

I did find that some email providers such as AOL were rejecting emails sent from my VPS. Email is a complicated thing - there are black lists and there are white lists and there are lists that I don't know about. There's SPF and DKIM and what not. The simplest way to by-pass all this and ensure that your emails make it to where they need to go is to get an account at Mailgun and use their SMTP servers to send your mails. You can still receive emails at your own server, but I'd rather let the professionals handle my delivery. Their recent price change allows you to send up to 10,000 emails for free per month, which unless you are a spammer, should be more than enough for personal use.

If you run your own mail server as well, I'd be curious to know your set up!