On Cloudflare DNS setting page it state that An A, AAAA, CNAME, or MX record is pointed to your origin server exposing your origin IP address.
I have an MX record on my domain pointing to mail.mydomain.com
. I believe it is something needed for the mail to work. How can I prevent it from exposing my origin IP address?
CloudFlare forwards your traffic through their network by replacing the IP in DNS records with CloudFlare's IP. This process works well in all situation except mail servers. CloudFlare does not offer any service for forwarding mail and as such when you take a MX record and point it to a CloudFlare forwarded domain, CloudFlare will give away server's real IP.
Instead a better practice is to use a third party mail service (such as Zoho, or Google Apps, etc.), or have your mail server running on a different IP. You can then point the MX record to the new record or mail server not located on your machine, and keep the real IP hidden safely.
Good luck
1 of 2 solutions:
Delete the MX record that CloudFlare uses. (Since they don't use it anyway.)
Replace your MX domain text (mail.example.com) with its domain IP numbers (44.123.12.44). Then CloudFlare WILL replace it correctly.
I'm not sure why mail-servers IP addresses should be kept top-secret. It's pretty easy to guess that example.com often will use mail.example.com. And email NEEDS to know the address anyway... otherwise it won't function.