The Ultimate Guide to Free Custom Domain Emails (Cloudflare + Gmail)
A complete, step-by-step guide to setting up unlimited custom domain emails using Cloudflare Email Routing and Gmail's SMTP servers.
What You Need to Get Started#
Before diving in, ensure you have the following ready:
- A Custom Domain: Purchased from any registrar (Namecheap, GoDaddy, etc.).
- A Cloudflare Account: The free tier is all you need.
- A Standard Gmail Account: This will act as your central inbox and outbound sending engine.
Part 1: Receiving Mail (Cloudflare Email Routing)#
Cloudflare acts as a relay server. It doesn’t store your emails; it catches messages sent to your custom domain and instantly forwards them to your personal Gmail inbox.
Step 1: Add Your Domain to Cloudflare#
- Log in to your Cloudflare dashboard and add your website.
- Select the Free plan.
- Update your domain’s nameservers at your registrar to point to Cloudflare (Cloudflare will provide the exact nameservers). Wait a short while for this to propagate.
Step 2: Configure Email Routing#
- In the Cloudflare dashboard, select your domain and click the Email tab on the left sidebar.
- Click Get Started or Enable Email Routing.
- Note on MX Records: Cloudflare will automatically prompt you to add its required MX and TXT records. Simply click to approve them.
- Enter the Destination Address (your standard Gmail address) and verify it by clicking the link Cloudflare sends to your inbox.
- Create your Custom Address (e.g., contact@yourdomain.com) and set the action to Forward to your verified Gmail address.
Emails sent to your custom domain will now appear in your Gmail inbox!
Part 2: Sending Mail (Gmail SMTP)#
To reply from your custom domain, we will use a legacy feature in Gmail that allows you to send mail through Google’s SMTP servers on behalf of another address.
Step 1: Generate a Google App Password#
Because you are using a third-party application (in this context, treating Gmail’s “Send mail as” tool as an external client), your standard password won’t work.
- Go to your Google Account Security settings.
- Ensure 2-Step Verification is enabled.
- Search for App Passwords and generate a new one (name it “Cloudflare Email”). Copy the 16-character code.
Step 2: Add the Address to Gmail#
- Open Gmail, click the gear icon (⚙️), and select See all settings.
- Navigate to the Accounts and Import tab.
- Under the “Send mail as” section, click Add another email address.
- Enter your Name and your Custom Email Address.
- Uncheck the Treat as an alias box. This ensures your professional identity remains separate from your personal Gmail identity when replying.
Step 3: Configure SMTP Settings#
In the next window, fill out the server details exactly as follows:
- SMTP Server: smtp.gmail.com (Do not use Cloudflare’s servers here, as they only receive, not send).
- Port: 587
- Username: Your full, original Gmail address.
- Password: The 16-character App Password you just generated.
- Connection: Secured using TLS.
Click Add Account. Google will send a verification code to your custom email. Since routing is already set up, it will land right in your Gmail inbox. Enter the code to finish.
Part 3: Securing Your Deliverability (SPF & DMARC)#
If you stop here, your outbound emails will likely land straight in your recipients’ spam folders. You must publicly authorize Google and Cloudflare to handle your mail by adding DNS records in Cloudflare.
The SPF Record#
Sender Policy Framework (SPF) tells the world which servers are allowed to send emails from your domain.
- Type: TXT
- Name: @
- Content:
v=spf1 include:_spf.mx.cloudflare.net include:_spf.google.com ~all
Cloudflare will already generate an SPF record for you, edit it to include the Google portion rather than creating a second record.
When an email arrives at a recipient’s server claiming to be from yourdomain.com, the receiving server checks your DNS. This record explicitly authorizes Cloudflare (for forwarding) and Google (for outbound SMTP) to send messages on your behalf. The ~all at the end is a “soft fail,” meaning “if the sender isn’t on this list, mark it as suspicious, but don’t outright delete it.”
The DMARC Policy#
DMARC helps protect your domain from spoofing. Add this basic monitoring policy:
- Type: TXT
- Name: _dmarc
- Content:
v=DMARC1; p=none;
If Cloudflare has already generated one record for you, verify it hasp=noneand keep it.
DMARC policy is an email validation system that uses DNS to instruct receiving mail servers on how to handle emails claiming to be from your own domain but failing authentication checks. It is denoted by the “p” tag in the DMARC record that specifies the action mail servers should take if an email fails DMARC validation. A properly implemented policy allows you to decide how strictly email providers should treat messages that don’t pass authentication. You can set your policy to:
- Let it through anyway (p=none)
- Flag it as suspicious (p=quarantine)
- Block it completely (p=reject)
Part 4: The Limitations & “The Real Solution”#
This free setup is incredibly powerful, but it has one technical flaw: DKIM Alignment.
When you send an email using Gmail’s free SMTP, the cryptographic signature (DKIM) attached to the email belongs to gmail.com, not yourdomain.com. While Gmail and many other providers accept this, highly strict providers like Yahoo and Outlook may flag it as a spoofing attempt and silently drop the email or bounce it with an “Authentication Failed” error.
How to Fix Strict Deliverability Issues#
If you absolutely cannot afford for emails to bounce (e.g., you run a business), you should swap out Google’s SMTP for a dedicated transactional email service.
- Sign up for a free tier on a service like SMTP2GO (1,000 free emails/month) or Brevo.
- Verify your domain with them, which will give you dedicated DKIM records to add to Cloudflare.
- Go back to Gmail’s “Send mail as” settings and replace
smtp.gmail.comwith your new provider’s SMTP server credentials.
This ensures your emails are perfectly signed by your own domain, guaranteeing delivery to even the strictest inboxes.
Bonus: Look Professional with BIMI#
Want your custom brand logo to appear next to your emails in the inbox? You can set up BIMI (Brand Indicators for Message Identification).
- Convert your logo to a strict SVG Tiny PS format.
- Host the SVG file on a secure URL (HTTPS).
- Add a TXT record in Cloudflare named
default._bimiwith the content:v=BIMI1;l=https://yourdomain.com/logo.svg;a=;
Once propagated, supported email clients will proudly display your logo alongside your messages, completing your professional email transformation.