Installing email server

I was thinking about hosting my own email server, and today I’ve decided to give it a try, so I spun up a Digital Ocean VPS and installed iRedmail, it was not easy the first time, I’ve chosen Ubuntu 20.04 and the script failed (yes iRedmail comes with a script that does all for you), then I reinstalled it as Debian and failed again, then Ubuntu 18.04 and once again failed, but this was because I picked up PostgreSQL, so I tried again with MariaDB and this time the script finished the installation succesfully.

Configuring DNS records

MailTester helps a lot on this topic, and tells you what to do, so after a few settings changes I’ve got 10/10 on MailTester.

These are the important things.

  1. PTR record: Digital Ocean does that for you if you enter a FQDN as the hostname at the time of creating your server.
  2. DKIM record: iRedMail will give you the instruccions on the first email you get on your admin account
  3. spf record: v=spf1 ip4:2.2.2.2 -all” (Change 2.2.2.2 with the IP address of your mail server, the public one, PTR should point to the A record)
  4. Dmard record: I’ve got this from MailTester

When all that is finished you will have working email server with unlimited accounts for just 5 dollars a month plus the domain cost.

Email on the go

Now, there is one thing I do not like about IMAP, and that it consumes battery on your cell phone because it works as pull email and not as push as ActiveSync enabled accounts does. But, there is also a solution for that.

It will cost you another 5 dollars (one time payment) on PushOver, register your account, donwload the app to your phone (you have 7 days for free), then go to your webmail interface, which is managed by RoundCube, then go to Settings -> filters and create a new one.

The one I’ve created catch all emails bigger than 1 byte, and sends a notification to the email address that PushOver provides you, the custom message I have chosen is You have a new email.

With all that setup, I configured my email on my favorite email App on Android, mine is Nine, set the account as IMAP, and configured it to manually check for emails.

So now, as soon as someone sends me an email, it arrives to the server, and triggers the email to PushOver, I got the alert and I can open Nine and refresh my account to read the email.

Final words

Now, I have my emails private, as long as the sender does not use Gmail :), and also have push notifications as soon as a new email touch the server, without too much battery waste.