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:
- An SMTP relay service that provides credentials for sending email through your domain
- 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
- Go to dash.cloudflare.com and click Add a site
- Enter your domain name (e.g.
yourdomain.com) - Select the Free plan
- Cloudflare will scan your existing DNS records and import them. Review to make sure nothing is missing
- Cloudflare gives you two nameservers (e.g.
aria.ns.cloudflare.comanddrake.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
- In Cloudflare dashboard, select your domain
- Go to Email > Email Routing in the left sidebar
- Click Get started (or Enable Email Routing)
- Cloudflare will automatically add the required MX records to your DNS
Cloudflare adds these MX records automatically:
isaac.mx.cloudflare.net - Priority 86linda.mx.cloudflare.net - Priority 29amir.mx.cloudflare.net - Priority 31Add a destination address
- Under Destination addresses, click Add destination address
- Enter your Gmail address (e.g.
yourname@gmail.com) - Cloudflare sends a verification email to that address - click the link to confirm
Create routing rules
Now tell Cloudflare which addresses to forward:
- Go to Routing rules tab
- Click Create address
- Set the custom address (e.g.
hello@yourdomain.com) - Set the destination to your Gmail address
- 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:
| Service | Free tier | SMTP server | Port |
|---|---|---|---|
| smtp2go | 1,000 emails/mo | mail.smtp2go.com | 587 |
| Brevo | 300 emails/day | smtp-relay.brevo.com | 587 |
| Amazon SES | None (pay-as-you-go) | email-smtp.us-east-1.amazonaws.com | 587 |
| Mailgun | 100 emails/day (trial) | smtp.mailgun.org | 587 |
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.
- Create an account at smtp2go.com
- Go to Settings > Sender Domains and add your domain
- smtp2go gives you DNS records to add (SPF and DKIM) - we will handle these in Step 5
- Go to Settings > SMTP Users and create a new SMTP user
- Save the username and password - you will need these for Gmail
mail.smtp2go.com587your-smtp-usernameyour-smtp-passwordStep 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
- Open Gmail and go to Settings (gear icon) > See all settings
- Go to the Accounts and Import tab
- Under Send mail as, click Add another email address
- Enter your name and custom email address (e.g.
you@yourdomain.com) - Uncheck "Treat as an alias" if you want replies to go to your custom address rather than your Gmail address
- Click Next Step
Enter SMTP credentials
- SMTP Server:
mail.smtp2go.com(or your provider's server) - Port:
587 - Username: your SMTP username from Step 3
- Password: your SMTP password from Step 3
- Select Secured connection using TLS
- 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:
TXT@v=spf1 include:_spf.mx.cloudflare.net include:spf.smtp2go.com ~allCritical: 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.
CNAMEs1._domainkeys1.domainkey.smtp2go.comAbout 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:
TXT_dmarcv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.comBreaking down the DMARC policy:
p=none- monitor mode. Emails that fail checks are still delivered, but you get reportsrua=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
- In Gmail, compose a new email
- In the From field, select your custom domain address
- Send it to a different email account (another Gmail, Outlook, etc.)
- Check that it arrives in the inbox (not spam)
Check 2: Inspect email headers
- Open the test email you received
- Click the three-dot menu > Show original
- Look for these results:
PASSPASSPASSCheck 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=noneinstead ofp=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 setup | With SendMailAs |
|---|---|
| Sign up for SMTP relay | Built-in SMTP relay |
| Manually add SPF, DKIM, DMARC records | Automatic DNS configuration |
| DKIM signed by relay domain ("via" banner) | DKIM signed by your domain (no "via") |
| Manually merge SPF includes | Handled automatically |
| No monitoring if records break | Continuous DNS monitoring |
| 30-60 minutes setup per domain | 5 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.