Blog/Guide

Cloudflare Email Routing + Gmail Send As

The complete guide to receiving and sending custom domain email through Gmail - without paying for Google Workspace. Every DNS record, every setting, every gotcha.

Mohit Gaddam15 min read

TL;DR

Cloudflare Email Routing handles receiving email at your domain for free. To send from your domain in Gmail, you need an SMTP relay and correct DNS records. This guide walks through every step. Or skip to the 5-minute automated setup.

How Cloudflare Email Routing works

Before touching any settings, it helps to understand what Cloudflare Email Routing actually does - and what it does not do.

Cloudflare Email Routing is a forwarding service. When someone sends an email to you@yourdomain.com, Cloudflare receives it and forwards it to your Gmail address. That handles the receiving side.

But Cloudflare Email Routing does not handle sending. When you hit reply in Gmail, the email goes out as you@gmail.com - not your custom domain. To send as your domain, you need two additional pieces:

  1. An SMTP relay service that provides credentials for sending email through your domain
  2. Gmail's Send mail as feature, configured with those SMTP credentials

This guide covers both sides: receiving via Cloudflare, and sending via an SMTP relay integrated with Gmail.

What about the "via" banner? When Gmail shows "via someserver.com" next to the sender name, it means DKIM alignment is off. The sending server signed the email with its own domain, not yours. We cover how to fix this in Step 5.

What you need

Prerequisites before you start

Before starting, make sure you have:

A domain name

Any registrar works - Namecheap, GoDaddy, Google Domains, Porkbun, etc.

A Cloudflare account (free)

Your domain's DNS must be managed by Cloudflare. If it isn't already, you'll point your nameservers to Cloudflare in Step 1.

A Gmail account

A free personal Gmail account. Google Workspace is not required.

An SMTP relay service

For sending email. Options include smtp2go (free tier: 1,000 emails/month), Brevo (free tier: 300 emails/day), Amazon SES ($0.10 per 1,000 emails), or Mailgun.

Time estimate: The manual setup takes 30-60 minutes if everything goes smoothly. Most of that time is waiting for DNS propagation and verifying records. If you want it done in 5 minutes, skip to the automated method.

Step 1: Set up Cloudflare DNS

Point your domain to Cloudflare

If your domain already uses Cloudflare DNS, skip to Step 2. Otherwise, you need to move your DNS to Cloudflare first.

Add your domain to Cloudflare

  1. Go to dash.cloudflare.com and click Add a site
  2. Enter your domain name (e.g. yourdomain.com)
  3. Select the Free plan
  4. Cloudflare will scan your existing DNS records and import them. Review to make sure nothing is missing
  5. Cloudflare gives you two nameservers (e.g. aria.ns.cloudflare.com and drake.ns.cloudflare.com)

Update nameservers at your registrar

Log in to your domain registrar and replace the existing nameservers with the two Cloudflare provided. The exact location varies by registrar:

  • Namecheap: Domain List > Manage > Nameservers > Custom DNS
  • GoDaddy: My Products > DNS > Nameservers > Change
  • Porkbun: Domain Management > Nameservers
  • Google Domains: DNS > Custom name servers

Propagation time: Nameserver changes usually propagate within 10-30 minutes, but can take up to 24 hours. You can check status at whatsmydns.net by looking up your NS records. Wait until Cloudflare shows your site as Active before proceeding.

Step 2: Enable Cloudflare Email Routing

Receive email at your custom domain

Enable email routing

  1. In Cloudflare dashboard, select your domain
  2. Go to Email > Email Routing in the left sidebar
  3. Click Get started (or Enable Email Routing)
  4. Cloudflare will automatically add the required MX records to your DNS

Cloudflare adds these MX records automatically:

MX Records (added automatically)
MXisaac.mx.cloudflare.net - Priority 86
MXlinda.mx.cloudflare.net - Priority 29
MXamir.mx.cloudflare.net - Priority 31

Add a destination address

  1. Under Destination addresses, click Add destination address
  2. Enter your Gmail address (e.g. yourname@gmail.com)
  3. Cloudflare sends a verification email to that address - click the link to confirm

Create routing rules

Now tell Cloudflare which addresses to forward:

  1. Go to Routing rules tab
  2. Click Create address
  3. Set the custom address (e.g. hello@yourdomain.com)
  4. Set the destination to your Gmail address
  5. Save

You can add as many rules as you want - info@, support@, hello@ - all forwarding to the same Gmail inbox. You can also enable a catch-all rule to forward everything.

Test receiving

Send a test email to your custom domain address from a different email account. It should arrive in your Gmail inbox within a few seconds. Check the email headers to confirm it came through Cloudflare.

Receiving is now working. Emails sent to you@yourdomain.com land in your Gmail inbox. But when you reply, it still sends from your Gmail address. The next steps fix that.

Step 3: Set up an SMTP relay

Get SMTP credentials for sending email

To send email as your custom domain from Gmail, you need an SMTP relay service. This is a server that accepts your outgoing email and delivers it on behalf of your domain.

There are several options. Here are the most common ones for personal/small business use:

ServiceFree tierSMTP serverPort
smtp2go1,000 emails/momail.smtp2go.com587
Brevo300 emails/daysmtp-relay.brevo.com587
Amazon SESNone (pay-as-you-go)email-smtp.us-east-1.amazonaws.com587
Mailgun100 emails/day (trial)smtp.mailgun.org587

Example: Setting up smtp2go

We will use smtp2go as the example since it has a generous free tier and straightforward setup. The process is similar for other providers.

  1. Create an account at smtp2go.com
  2. Go to Settings > Sender Domains and add your domain
  3. smtp2go gives you DNS records to add (SPF and DKIM) - we will handle these in Step 5
  4. Go to Settings > SMTP Users and create a new SMTP user
  5. Save the username and password - you will need these for Gmail
SMTP Credentials (save these)
Servermail.smtp2go.com
Port587
Useryour-smtp-username
Passyour-smtp-password

Step 4: Configure Gmail Send As

Send from your custom domain inside Gmail

Now connect Gmail to your SMTP relay so you can send email as your custom domain.

Add a "Send mail as" address

  1. Open Gmail and go to Settings (gear icon) > See all settings
  2. Go to the Accounts and Import tab
  3. Under Send mail as, click Add another email address
  4. Enter your name and custom email address (e.g. you@yourdomain.com)
  5. Uncheck "Treat as an alias" if you want replies to go to your custom address rather than your Gmail address
  6. Click Next Step

Enter SMTP credentials

  1. SMTP Server: mail.smtp2go.com (or your provider's server)
  2. Port: 587
  3. Username: your SMTP username from Step 3
  4. Password: your SMTP password from Step 3
  5. Select Secured connection using TLS
  6. Click Add Account

Verify the address

Gmail sends a verification email to your custom domain address. Since you set up Cloudflare Email Routing in Step 2, this email gets forwarded to your Gmail inbox. Open it and click the confirmation link (or enter the code).

Set as default (optional)

Back in Accounts and Import, click make default next to your custom domain address. Now all new emails send from your domain by default.

You can now send and receive. But without proper DNS authentication records, your emails may land in spam or show a "via" warning. The next step fixes that.

Step 5: Add SPF, DKIM, and DMARC records

Authenticate your email to avoid spam folders

This is the step most guides get wrong - or skip entirely. Without SPF, DKIM, and DMARC, your emails will likely land in spam. For a deep dive on what these are, read our SPF, DKIM, DMARC guide.

SPF record

SPF tells receiving servers which servers are allowed to send email for your domain. You need to include both Cloudflare (for forwarded email headers) and your SMTP relay.

Cloudflare may have already added a basic SPF record. You need to merge your SMTP relay's include into it. The final record should look like this:

SPF Record
TypeTXT
Name@
Valuev=spf1 include:_spf.mx.cloudflare.net include:spf.smtp2go.com ~all

Critical: You can only have one SPF record per domain. If you already have an SPF record, merge the include: statements into the existing record. Do not create a second TXT record with v=spf1.

DKIM record

DKIM proves your emails were not tampered with in transit. Your SMTP relay provides the DKIM record to add.

In smtp2go: go to Settings > Sender Domains > your domain. Copy the DKIM CNAME records they provide and add them to Cloudflare DNS.

DKIM Record (example - use values from your SMTP provider)
TypeCNAME
Names1._domainkey
Targets1.domainkey.smtp2go.com

About the "via" banner: When the DKIM signature is from the SMTP relay's domain (not yours), Gmail shows "via smtp2go.com" next to your name. To remove this, the DKIM key must sign with your domain. Most free-tier SMTP services sign with their own domain. This is a fundamental limitation of the manual approach.

DMARC record

DMARC ties SPF and DKIM together and tells receiving servers what to do when checks fail. Start with a monitoring policy:

DMARC Record
TypeTXT
Name_dmarc
Valuev=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com

Breaking down the DMARC policy:

  • p=none - monitor mode. Emails that fail checks are still delivered, but you get reports
  • rua=mailto:... - where to send aggregate reports. Replace with your email

After confirming everything works (give it a week), tighten the policy to p=quarantine (spam folder) or p=reject (bounce).

Step 6: Verify everything works

Confirm delivery and authentication

After adding all DNS records, wait 5-10 minutes for propagation (Cloudflare is fast), then run these checks:

Check 1: Send a test email

  1. In Gmail, compose a new email
  2. In the From field, select your custom domain address
  3. Send it to a different email account (another Gmail, Outlook, etc.)
  4. Check that it arrives in the inbox (not spam)

Check 2: Inspect email headers

  1. Open the test email you received
  2. Click the three-dot menu > Show original
  3. Look for these results:
Expected Authentication Results
SPFPASS
DKIMPASS
DMARCPASS

Check 3: Use an online tool

Send a test email to mail-tester.com to get a detailed deliverability score. Aim for 9/10 or higher. Common deductions:

  • Missing DKIM alignment (shows as "via" banner)
  • Overly permissive DMARC policy (p=none instead of p=reject)
  • Missing reverse DNS on the SMTP relay (provider issue, not in your control)

Common problems and fixes

Gmail says 'Authentication failed' when adding Send As

Double-check your SMTP credentials. Make sure you are using port 587 with TLS (not 465 with SSL). Some providers also require you to verify the sender domain before SMTP access works.

Emails show 'via smtp2go.com' next to sender name

This means DKIM is signing with the relay's domain, not yours. Check if your SMTP provider supports custom DKIM signing on the free tier. Most do not - this is a paid feature on many providers. SendMailAs signs with your domain automatically.

Emails land in spam

Check SPF, DKIM, and DMARC records using mxtoolbox.com. The most common cause is a missing or incorrect SPF record. Also verify that your SMTP relay has verified your sender domain.

Cloudflare email routing is not receiving emails

Verify MX records point to Cloudflare's email servers (not your old provider's). Check that the destination address is verified. Look at Cloudflare's Email Routing activity log for errors.

Gmail verification email never arrives

The verification goes to your custom domain address, which Cloudflare forwards to Gmail. Check that the routing rule for that address is active. Check spam folder. If using catch-all, make sure it is enabled.

SPF record has too many DNS lookups (permerror)

SPF allows a maximum of 10 DNS lookups. Each 'include:' statement counts as one or more lookups. If you use multiple email services, you may hit this limit. Remove services you no longer use. Tools like mxtoolbox.com/spf.aspx can count your lookups.

Too many steps?

SendMailAs automates all of this

No SMTP relay to configure. No DNS records to merge. No "via" banner. Point your nameservers to Cloudflare, add your domain, and you are done in 5 minutes.

The easier way: automate it with SendMailAs

Skip the SMTP relay, DNS records, and troubleshooting

The manual setup works, but it has real pain points. You need to sign up for a separate SMTP relay, manage DNS records across two dashboards, deal with DKIM alignment issues, and troubleshoot deliverability when something changes.

I built SendMailAs because I got tired of doing this myself across a dozen domains. Here is what it replaces:

Manual setupWith SendMailAs
Sign up for SMTP relayBuilt-in SMTP relay
Manually add SPF, DKIM, DMARC recordsAutomatic DNS configuration
DKIM signed by relay domain ("via" banner)DKIM signed by your domain (no "via")
Manually merge SPF includesHandled automatically
No monitoring if records breakContinuous DNS monitoring
30-60 minutes setup per domain5 minutes per domain

Step 1: Add your domain

Point your nameservers to Cloudflare (if not already). Add the domain in SendMailAs. DNS records are configured automatically.

Step 2: Add your Gmail address

Enter the Gmail address where you want to receive email. SendMailAs sets up email routing and SMTP credentials.

Step 3: Connect Gmail

SendMailAs gives you pre-filled SMTP credentials to paste into Gmail's Send As settings. One step instead of managing a separate SMTP relay account.

First domain is free forever. Unlimited domains cost $29/year - less than a single month of Google Workspace.

Frequently asked questions

Yes. Cloudflare Email Routing is completely free with any Cloudflare plan, including the free tier. There are no limits on the number of routing rules or destination addresses. The only requirement is that your domain uses Cloudflare DNS.

Yes. Gmail's 'Send mail as' feature lets you send from any email address as long as you have SMTP credentials for it. You need an SMTP relay service to provide those credentials. Options include smtp2go, Brevo (formerly Sendinblue), Amazon SES, or SendMailAs which automates the entire setup.

This happens when SPF or DKIM alignment fails. The sending server's domain doesn't match the From address domain. To fix it, you need DKIM signing with a key that matches your From domain - not just the SMTP relay's domain. SendMailAs solves this by signing with your domain's DKIM key automatically.

Yes. You can create a catch-all rule that forwards all email sent to any address at your domain. In the Cloudflare dashboard, go to Email Routing > Routing rules and add a catch-all rule. This is useful if you want to receive email at any address without creating individual rules.

Yes. Each domain on Cloudflare can have its own email routing rules. You can forward mail from multiple domains to the same Gmail inbox. For sending, you will need SMTP credentials for each domain - this is where the setup gets complex with the manual method.

If Cloudflare's email routing is unavailable, incoming emails will queue on the sending server and retry according to standard SMTP retry rules (typically up to 5 days). Cloudflare has 99.99% uptime SLA for their network. For sending, your SMTP relay has its own availability guarantees.

If your domain already uses Cloudflare DNS, email routing starts working within minutes after adding MX records. If you're migrating DNS to Cloudflare, it depends on DNS propagation - typically 1-30 minutes, but can take up to 48 hours in rare cases.

Yes, but with caveats. This setup works well for solopreneurs, freelancers, and small teams who want branded email without paying for Google Workspace. For larger teams that need shared calendars, admin controls, and compliance features, Google Workspace or Microsoft 365 may be more appropriate.

Custom domain email in 5 minutes

Skip the manual DNS setup. SendMailAs automates Cloudflare email routing, SMTP relay, and authentication records. First domain free.