Can't receive emails in mail clients with Cloudflare


I am using Cloudflare for my domain and since then I cannot get emails over IMAP on my mail clients.
Is it because CNAME Flattening maybe that is enabled as: Flatten Cname as apex

Or the issue is from my current DNS settings?
When I try to Unproxify the A records it gets back to normal, but I need the proxyfication to have my website load with CDNs if I understand properly this feature.

My DNS settings are as follows:

Your help would be much appreciated, thanks!

If your mail server and web server are on the same IP address, you’ll need to create an unproxied subdomain (such as mail) to connect your mail client to and also use as the target for your MX record.

Cloudflare only proxies HTTP/HTTPS traffic (unless using Cloudflare Spectrum) so any mail traffic needs to go through unproxied subdomains. You can keep your domain, www and wildcard record proxied.

1 Like

Thanks a lot @sjr for your prompt reply.
My mail server is the same as my domain.
Do you mean I have to create an A record with and the IP of my server
As for my MX record it’s currently to set the root and using with 10 of priority.

Thanks in advance!

Yes, make sure it is set to “DNS only”. Then change your MX record for the root to point at

1 Like

Trying this and will let you know thanks a mill!

Hi again,

It seems to be the same after I set up these:
A record: pointing to my server IP 78.xxxx
MX record: mail 10

Any idea maybe? Thanks!

You will also need to change the configuration of your email client, so that it is using “” as the server name, instead of just “”.

1 Like

That’s working - check your mail client is connecting to

This should be for the root domain (@), not the mail subdomain, and (as you have) point to

1 Like

Hi @DarkDeviL thx for the assist!
Somehow 2 things worked for furture reference if anyone needs to:
I changed that MX from mail.domain.tld to domain.tld instead, kept that A record with “mail” and pointing to my server, then went to my email client (K9) and edited the IMAP server from domain.tld to mail.domain.tld .

Very tedious to use Cloudflare as I was expecting but was a great learning proably useful for the future!

Thanks @sjr for the assistance as well!

Btw @sjr I loooove your self hosted Network diagnostics tool, how is it called? Maybe I can self host on Truenas for instance or a VM?

As you’re hiding your own domain here, - I’m moving on with “”.

Same thing as you did with your email client, should also be done with the MX record.

You should therefore change the “Mail server (required)” field, of the MX record, so that it is pointing to the full “” address, rather than just “”.

1 Like

Hi @DarkDeviL that MX record did not work and had to move to instead of

You’re confusing the two fields.

The one you made previously, was this:

And that one is incorrect, and will not work.


That statement means:


And that one is correct, and will work.

1 Like

Thanks a lot for your assistance both!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.