One of the main reasons of putting your server behind CloudFlare is to hide your server's IP address so an attacker can't DDoS your IP and render CloudFlare obsolete. By putting your server behind CloudFlare their IPs are exposed to the outside world so your server's IP address is only known to you and nobody else.
The problem here is when you want to use a contact form on you website to receive mail from your visitors. By using the contact form, basically your original server's IP is sending emails to you or whichever address you want.
But now since the server is behind CloudFlare the following SPF record becomes a hindrance
v=spf1 a include:_spf.google.com ~all
because that letter a
between v=spf1
and include:_spf.google.com
tells that all IPs that have A record in DNS are permitted to send email. However, by using CloudFlare, the original server's IP is no longer visible, and CloudFlare's IP becomes identified as the one which is permitted to send emails, not your real server's IP. And as result, every email sent through PHP, from you server, is marked as spam because that IP is now basically not allowed to send email.
Of course you can add your real server's IP in your SPF record, as shown below, to allow it to send emails and solve the problem right there
v=spf1 a ip4:xxx.xx.xxx.xx include:_spf.google.com ~all
but that would defeat the purpose of using CloudFlare in the first place. They too explicitly tell you not to put your server's IP anywhere that can be publicly revealed including SPF and TXT entries.
When you want to send/receive emails directly by using Google Apps, there is of course no problem because you're using Google Servers to accomplish that (your SPF record says they're allowed to do so) but in the case above you're unable to use a simple contact form on your website if you want to use CloudFlare.
You can also change the last bit in the SPF record from ~all
to ?all
so all other IPs other than those specified in the SPF record can be treated as neutral, but that would not stop marking the emails from your contact form as spam.
Am I missing here something very obvious or if you want to use CloudFlare you should forget about using you server's IP at all?