The holy grail email stack: Cloudflare and MXroute

4th June 2025

Preamble

Affordability, autonomy, reliability – pick any two. The overwhelming majority will opt for the first and the last by using a major free provider like Gmail. This is probably the most sensible option, and if you are contented with this, this post is probably a waste of your time. If, however, you feel some investment in the Panglossian ideal of email – federation, interoperability, everyone and their mother having their own servers and domain and so on – autonomy becomes a salient consideration. There are pragmatic reasons to care about it too: given the centrality of email to our digital lives, decoupling your address from your provider is valuable insurance against vendor lock-in. If they change their terms of service in a way you don’t like or your account is arbitrarily suspended for a minor infraction (e.g. using an adblocker, creating multiple accounts on the service), you won’t have to go through the agonising ordeal of rerouting all of your accounts, contacts, etc. Some will argue that privacy is also a consideration when choosing a provider, but for me, it’s a wash. The people you email probably have unencrypted inboxes with major providers, it is what it is. Email ought to be considered as ‘electronic mail’ proper – as private as letters you would send a friend through a postal service.

Turnkey solutions like Fastmail or Google Workspace will let you send and receive mail effortlessly from your own domain, but you compromise on price: for a single user, Fastmail is £54pa, or £120pa for the family plan. Personally, I find it very difficult to justify spending this much on something as gratuitous as custom email when entirely free and performant alternatives exist.

The final option is affordable autonomy in the form of services like Zoho and PurelyMail. This is what I went with for a while. Generally, these services are ok for the price (£10-20 per year), but they are by and large rather unpleasant to use, have poor spam filtering, sync errors, and abysmal deliverability due to poor IP reputation. Ultimately it’s the last of these that forced me to stop. If you cannot be confident that your emails are delivered to your recipient’s inbox then the entire endeavour is damned.

The setup

I think I have found a way to have my cake and eat it too: using Cloudflare email routing to a Gmail address for inbound, and MXroute for outbound. Cloudflare’s forwarding service is free provided that you use their DNS servers for your domain, and as you would expect, is incredibly reliable. Gmail’s spam filtering and webmail client are best-in-class. MXroute is a small but high-quality service that aims to solve email deliverability completely. The owner aggressively polices use of MXroute to maintain its IP reputation, and in the event of failed delivery, they resend from another IP address in their pool until the email is delivered. They are also absurdly cheap: they have a Black Friday discount that seemingly runs year-round, which is $15 for 3 years or $75 for a lifetime plan. All of their plans let you have an unlimited number of domains and users. This means that I can run email for my whole family for $5 a year.

They keep the prices so low in a few ways. Firstly, the mailboxes have rather limited storage: the lifetime plan, for example, only affords you 5gb total, shared between your mailboxes. Secondly, their server infrastructure is old school: if there is a (very rare) service outage, they don’t have major redundancy. We solve both of these problems by only using MXroute for outbound mail; Cloudflare and Gmail for inbound mean that we never have to worry about running out of storage or a service outage preventing us from receiving 2FA codes and other such time-critical email. Thirdly, their frontend is a bit janky and requires some technical know-how to use, and they discourage contacting support for basic setup questions. Hopefully I will be able to solve this by providing step-by-step setup instructions below - there is some upfront labour, but it’s set-and-forget.

Inbound (Cloudflare)

  1. You will need to either register a domain with Cloudflare, or if you own a domain elsewhere, switch your DNS to Cloudflare.
  2. Once registered, click on your domain and open the email settings. Here, you should have the option to enable email routing. Cloudflare will automatically add the necessary records to your DNS. Cloudflare email settings
  3. Once configured, navigate to Routing rules and add all of the custom addresses you require, along with the Gmail address you want the mail to be routed to. Cloudflare will send a verification email to each of those destination addresses. After you verify, that’s it! Any mail addressed to your chosen custom address will show up in the associated Gmail. It would be a good idea to send a test email to this address to make sure everything is working.

Outbound (MXroute)

  1. Now we need to set up sending. Head to MXroute’s black friday site and pick up their cheapest plan; if a discount is not available, head to their main website – even full price, it’s pretty affordable.
  2. Once you’ve purchased the plan, navigate to Services and click on your plan to open its settings. MX route plan settings
  3. From here, you can launch the control panel. Open control panel
  4. Now, you need to add the addresses you want to send from. To do this, navigate to E-mail Manager > E-mail Accounts > Create Account. Here, you’ll be able to set a username and password for each mailbox. Since we are only using MXroute for sending, the email quota doesn’t matter, but make sure each email address has the maximum daily send limit. N.B. you can ignore the ‘default’ address that already shows up under the account list, it’s non-functional and for backend purposes. Create email account
  5. Now, you need to add the requisite records to your Cloudflare DNS to associate your domain with MXroute. There are 3 records you’ll need to set up for sending: SPF, DKIM, and DMARC. Head back to your Cloudflare domain settings, and click on DNS. Cloudflare DNS
  6. MXroute will have sent you an email with the title ‘Important Account Information’. In this email, it will tell you what the contents of your SPF record have to be. This is what it says in mine: MXroute SPF record
  7. Cloudflare has already created an SPF record in order to forward mail to you. You need to edit it to include the MXroute address too. Find it in the list of DNS records, and modify it like so, i.e. add a new “include:address and change the tilde in front of ‘all’ to a dash. Cloudflare SPF record
  8. The DKIM record is slightly more involved. You have to go back to the email control panel, navigate to Account Manager > DKIM Keys and copy it from here: DKIM key
  9. Copy the name and value from here exactly into a new DNS record on Cloudflare, like so: Cloudflare DKIM
  10. Finally, create a DMARC record. There’s a whole theory behind this, but if you don’t care to look into it, just copy this exactly: DMARC record
  11. All of your sending configuration is now complete. Wait a few minutes for things to propagate. The only thing left to do is set up send mail as in Gmail, so you can use your new custom domain email as an alias from within Gmail.

Sending from within Gmail

  1. Open Gmail and log into the account you are forwarding to. Navigate to Settings > See all settings > Accounts and Import > Send mail as > Add another email address Gmail settings
  2. Here, enter the name you want to use with this email and the custom address you’ve set up. Make sure to leave treat as an alias ticked. Send mail as
  3. Now, you will be prompted to enter an SMTP server address, port number, username, and password. The SMTP server address and port that Google guesses are wrong; you can find the correct ones in the same MXroute email that you found the SPF information in. The username is the custom email you want to send from, and the password is the password you set for this mailbox in the email control panel earlier. Here’s mine: Send mail as 2 SMTP settings in email
  4. After you enter these, you’ll be sent a confirmation email from Gmail for using this email as an alias. And that’s it! You’re done. The alias is selectable from a dropdown when you compose new emails (both in the browser and in the Gmail mobile app). You can also set this alias to be the default email address when composing new emails: Make default

Is this a lot of work? Yes, absolutely. But it’s also just 30 minutes of your life, done once, and in return you get affordable, autonomous and reliable email for as long as MXroute continues to exist/until Google deprecates the ‘send mail as’ function.