Some Bits: Nelson's log

Email woes again, CloudFlare setup

A few months ago I gave up using monkey.org for my email and moved my email setup to my personal domain somebits.com. I was using Google Workspace as the MX entry for receiving mail for that domain; as of today I’m using CloudFlare. So far so good.

Google Workspace problems

The setup I was using was to pay for Google Workspace and have them receive all mail for my domain via an MX entry. Google Workspace was then told to forward all of it to my personal @gmail.com account. This worked pretty well but every once in awhile friends @yahoo.com or @hotmail.com would complain that a message bounced.

The problem turns out to be the way Google Workspace forwards email to Gmail. They don’t do it right! I’m not confident but I think they’re not doing SRS or ARC correctly. So Gmail receives this mail claiming to be from some random @yahoo.com person and to me@gmail.com, but the mail isn’t correctly signed and so Gmail rejects it as spam. It didn’t happen often, not as often as my old monkey.org setup, but it happened enough to annoy me. Google should be able to forward mail to itself reliably!

It’s possible I could have fixed this by not using Google Workspace to forward the whole domain and instead just to forward individually from my name @somebits.com to my personal Gmail. Some reports suggest ARC/SRS works better in this configuration. I didn’t try it.

CloudFlare Email

Instead I followed an AI’s advice and have switched to using CloudFlare as my MX provider, a feature they call “Email Routing”. (The other option was forwardemail.net). It’s simple but seems good. The free tier is all I need. You can have CloudFlare forward email to specific names @ your domain to specific destination email addresses. There’s also a Catch All forwarding option that’s off by default.

The key thing is CloudFlare seems to be doing ARC and SRS stuff correctly. Email I send to myself from yahoo mail arrives fully intact and properly signed as far as Gmail is concerned. Yay!

As part of this change I also made CloudFlare the nameserver of record for my domain instead of Porkbun. I’m not sure that’s 100% necessary but it makes things easier on CloudFlare. Also they are the best in the business at providing DNS so why not?

One gotcha: CloudFlare email routing doesn’t support subdomains, at least not easily. I wanted to test all this just for test.somebits.com at first but it was either all of somebits.com or nothing.

Another gotcha: CloudFlare rewrites the SPF record for your domain saying only CloudFlare is authorized to deliver email for your domain. This isn’t a total disaster, it’s a soft fail, but it means that Gmail can’t sign mail it sends for you. The solution is to hand edit the SPF record to include both Gmail and Cloudflare as authorized senders. The test address auth-results@verifier.port25.com was a big help in figuring this problem out.

(It’s a bit weird that CloudFlare injects itself in the SPF records because CloudFlare doesn’t yet offer a service that delivers email for you. Ie, no outgoing SMTP. You have to send your mail out via Gmail or someone else. The AI says that ClouldFlare still needs an SPF record so that the mail forwarding is allowed and properly signed. Anyway a hybrid SPF record seems to work fine.)

Update: Cloudflare is better

Cloudflare’s email forwarding is better. All my forwarded email used to show up in my Gmail with failing SPF. Now it shows as passing. I can no longer understand email headers, particularly all the signature stuff, but apparently the difference is Cloudflare is doing the Sender Rewriting Scheme (SRS) whereas Google Workspace does not. According to Gemini the crucial difference is the Return-Path header, which reflects the data sent on the MAIL FROM part of the SMTP exchange:

FeatureEmail 1 (Failed SPF)Email 2 (Passed SPF)
Return-Pathsomeone@hotmail.comSRS0=tzui=rb=hotmail.com=someone@somebits.com
SPF CheckChecked against hotmail.comChecked against somebits.com
ResultFail (Google isn’t a Hotmail server)Pass (Cloudflare is allowed for somebits.com)

I don’t really understand all this stuff. But Workspace seems to be just forging mail when it forwards it to Gmail, pretending to be sending on behalf of hotmail.com. Cloudflare is being more honest that the email is really from my domain somebits.com but still mentions the hotmail addresses. The actual From header is hotmail in either case, that’s the one I most care about since it’s what is displayed.

I still think Gmail should have special rules for accepting email from Google Workspace. But I can see why they don’t, both for technical reasons and for anti-trust reasons. Failing that, why isn’t Workspace doing SRS?