Mail server setup on DigitalOcean with CloudFlare

Robin R asked:

I’m trying to make my own mail server. The problem is, it doesn’t work at all. I’ve tried to install postfix, wich didn’t work (Couldn’t receive mails) and then I tried Exim, didn’t work too…

I’m using a DigitalOcean server (the server of 5$/mo.) And a cloudflare normal account.

So what I want is that I can send and receive e-mails from my own domain.
I’ll integrate later on a function to receive mails in my web app…

But right now, I’m kinda stuck on the setup, and usage.

This is my DNS on CloudFlare:

Hidden is my IP adress of my server.

I can’t sent nor receive any e-mail traffic…
I’m using Ubuntu 14.04 x64.

Could someone explain me in a really good way how I should handle and build my own e-mail server?

If there is something wrong with my DNS, pleae tell me how and what I need to fix.

Kindest regards,


My answer:

In the CloudFlare DNS settings, make sure that you have a “gray” cloud for the mail A record, in order for connections to that host to bypass CloudFlare and go to your mail server directly. CloudFlare does not proxy SMTP traffic.

An example of a working domain:

CloudFlare DNS settings

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.