How to make a domain receiving email behind cloudflare?

hkguile asked:

I have a web server hosting multiple domains (centos + postfix + dovcot), one of my domain its dns is hosted on cloudflare (ie., but when I use gmail to send email to a [email protected], [email protected] will not be able to receive the email. Here is the MX record I set in cloudflare:

Type   Name   Value                                       TTL          Active
mx     mail   handled by with priority10    Automatic     
cname  mail   is an alias of                     Automatic    grey cloud

Any knows how can I make the domain receive the emails?

My answer:

You have two distinct errors in your configuration:

  1. The MX record should be for your domain, not for a subdomain.

  2. An MX record should not point to a CNAME. Point it to a record with an IP address.

An example of a working domain:

CloudFlare DNS settings

View the full question and any other answers on Server Fault.

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