How I Set Up a Custom Domain Email With Gmail for Free (and the Mistakes I Made)

On this page
When I moved my site to Cloudflare, I forgot my email was still living somewhere else. My domain’s mail records pointed at the host I had just left. I wanted a professional address like [email protected] without paying for another inbox, so I set up a custom domain email with Gmail for free. It works beautifully now, but only after three mistakes I’m about to save you from.
In short
- Cloudflare Email Routing receives mail for your domain and forwards it to Gmail, for free.
- Gmail’s Send mail as feature lets you reply from that address, using a Google app password.
- Remove your old host’s mail records first, or Cloudflare won’t switch on.
- Use your full Gmail address as the SMTP username, not the name of your new address.
- Keep your domain’s DMARC policy relaxed, or your own emails can bounce.
Why My Email Broke When I Left My Host
My email broke because my domain still sent mail to Hostinger after I stopped hosting there. I had moved my site from WordPress to Astro on Cloudflare, and the website side went smoothly. The mail side was quietly left behind.
Your domain has a few DNS records called MX records. They tell the internet where to deliver email for your domain. Mine still said Hostinger. Once that plan ends, any email sent to your domain has nowhere to land.
If you are leaving a host, check this before you cancel. Look up your domain’s MX records in your DNS settings. If they point at your old host, this guide is for you.
What You Need Before You Start
You need three things, and all of them are free.
- A domain that uses Cloudflare for DNS. Email Routing only works when Cloudflare manages your domain’s DNS.
- A Gmail account. This is where your new address will live. You will read and send everything from here.
- 2-Step Verification on that Google account. You will need it to create an app password later. Turn it on now and save yourself a detour.
That is the whole shopping list. No paid inbox, no new app.

Two halves. Cloudflare handles the mail coming in, Gmail handles the mail going out.
How to Set Up a Custom Domain Email With Gmail
The setup takes five steps. The first two happen in Cloudflare, and the last three happen in your Google account and Gmail.
Step 1. Point Your Domain’s Mail at Cloudflare
The first step is to clear out your old host’s mail records, because Cloudflare refuses to start while they exist. This was my first mistake. I tried to switch on Email Routing and got this error.
Non-Cloudflare MX records exist
Cloudflare will not share your domain’s mail with another provider. You have to remove the old MX records and the old SPF record first. The SPF record is a line of text that lists who is allowed to send email for your domain.
Before you delete anything, take a screenshot or copy of your current DNS records. If something goes wrong, you can put them back.
Then do this.
- In Cloudflare, open your domain and go to Email, then Email Routing.
- Click Get started or Enable Email Routing.
- If Cloudflare lists conflicting records, remove the old MX records and the old SPF record.
- Let Cloudflare add its own records. It adds three MX records, a new SPF record and a DKIM record, which signs the mail it forwards.

My records before and after. The Google part of the SPF record comes later, and you add that one yourself.
One warning. The moment those old records are gone, your old host stops receiving mail for your domain. If you still have messages in that old inbox, save them first.

Enabled, with the mail records locked so nothing else can overwrite them.
Step 2. Forward hello@ to Your Gmail
Now tell Cloudflare which address to create and where to send its mail. Cloudflare calls this a routing rule.
- Under Destination addresses, add your Gmail address. Cloudflare sends it a verification email. Mine went through instantly, probably because it was the same address as my Cloudflare account. If yours doesn’t, click the link in that email.
- Under Routing rules, create a custom address. I used
hello, which makes[email protected]. - Set the action to Send to an email and choose your Gmail address.
- Save it.
Send a test from a different account, such as your work email or your phone. Don’t test from the same Gmail account. Gmail often hides mail you send to yourself, and you will think it failed when it didn’t.
Mine showed up in my Gmail inbox, and the receiving half was done.

Your Gmail has to show Verified here before Cloudflare will forward anything to it.
Step 3. Create a Gmail App Password
Gmail needs an app password to send mail through its servers as your new address. It is a 16-character password that lets one app use your Google account without your real password.
Go to myaccount.google.com/apppasswords, give it a name, and click Create.
This is where I hit my second wall. Instead of the page, I got this.
The setting you are looking for is not available for your account.
The usual cause is that 2-Step Verification is off. Google only offers app passwords once it’s on. Google’s help page lists a few other cases where the option is missing. They include a security key as your only second step, Advanced Protection, and a work or school account.
Once I turned on 2-Step Verification, the page opened and gave me my password.

No 2-Step Verification, no app passwords. Google doesn’t tell you that part.

Once 2-Step Verification was on, Google showed the password once. Mine is blurred here, and you should treat yours the same way.
Treat that password like your main one. It gives full access to your Google account. I learned this the slightly embarrassing way, by pasting mine into a chat to ask for help. Don’t do that. If you ever share it by accident, delete it on the same page and make a new one.
Step 4. Add Your Address to Gmail’s Send Mail As
With the app password ready, you can teach Gmail to send as your new address. Open Gmail on a computer, then go to Settings, See all settings and Accounts and Import. Next to Send mail as, click Add another email address.

Gear icon, See all settings, Accounts and Import. The link sits under Send mail as.
In the first window, enter your name and your new address. Leave Treat as an alias ticked. Google suggests unticking it only when you send on behalf of someone else, like a shared team address. For your own address, ticked is right.
In the second window, enter these settings.
| Field | What to enter |
|---|---|
| SMTP Server | smtp.gmail.com |
| Port | 587 |
| Username | Your full Gmail address |
| Password | The app password from Step 3 |
| Connection | Secured connection using TLS |
This is where my third mistake lived. Gmail filled the username box with hello, the name of my new address. I left it. Gmail answered with this.
Authentication error. Check your username and password.
The SMTP server here is Gmail’s, so it wants your Gmail login. Your username is your full Gmail address, not your new address. I changed it, pasted the app password again, and it went through.

The username says hello. That one word was the whole problem.
Gmail then emails a confirmation link to your new address. Thanks to Step 2, it lands in your Gmail inbox a moment later. Click the link, and your address is verified.

The window you want to see. One click in your inbox and you’re done.
Step 5. Make Replies Come From Your New Address
Gmail will still reply from your Gmail address until you tell it otherwise. That caught me out too. A test email came in to hello@, and my reply went out from my old Gmail.
In the same Accounts and Import section, find When replying to a message and choose Reply from the same address the message was sent to. Now anything sent to your new address gets answered from it.

My new address is listed, but look at the reply setting. It was still on the default address, and that is the one to change.
If you want every new email to use it as well, click make default next to your new address. You can also switch addresses on any single email with the From line in the compose window.
Add Your Photo to Your New Address (Optional Step)
Your email already works after Step 5. This step only changes how you look in other people’s inboxes. Gmail shows a sender’s photo only when that address has its own Google account. Your new address doesn’t have one yet, so people see a blank avatar.
You can fix this without creating a new inbox.
- Open a private browser window and go to accounts.google.com/signup.
- When Google suggests a Gmail address, choose Use your existing email instead.
- Enter your new address. Google sends a code there, and it forwards to your Gmail.
- Finish signing up, then upload your photo at myaccount.google.com.
This account exists only to hold your photo. Your mail keeps flowing through your main Gmail exactly as before. It can take a few hours for the photo to appear, and only Gmail users see it.

My new address, now with my photo. Notice the small “via gmail.com” too. More on that next.
What a Free Custom Domain Email With Gmail Can’t Do
This setup is a forwarder plus a borrowed sender, so it has limits worth knowing before you rely on it.
Your mail is signed by Gmail, not your domain. When you send through Gmail’s servers, the message carries Gmail’s signature. Your recipients see your custom address in the From line, but Gmail users also see a small “via gmail.com” next to your name, and the technical headers still show your Gmail account. For a personal brand or freelance work, that’s fine.
Your DMARC policy must stay relaxed. DMARC is a DNS record that tells inboxes what to do with mail that fails your domain’s checks. Because your mail is signed by Gmail rather than your domain, it doesn’t fully pass those checks. With a relaxed policy, p=none, it still gets delivered. If you ever tighten it to reject, your own emails can start bouncing. Leave it alone.
There is no separate inbox. Everything lands in your Gmail, mixed with your personal mail. A Gmail filter that labels mail sent to your new address keeps it tidy.
Add Google to your SPF record. When Cloudflare took over, it wrote an SPF record that only lists Cloudflare. I edited it to list Google too, so receiving servers know Gmail may send for my domain. Mine now reads v=spf1 include:_spf.mx.cloudflare.net include:_spf.google.com ~all. A domain can only have one SPF record, so edit the existing one rather than adding a second.
If you outgrow these limits, a paid service such as Google Workspace gives you a real mailbox and signs mail with your own domain. Until then, this costs nothing.
Let an AI Coding Agent Do the Cloudflare Half
An AI coding agent can do the whole Cloudflare side for you, but the Google side still needs your own hands. I set mine up with Claude Code, the same way I manage this site. Google Antigravity, OpenAI Codex, Cursor and Gemini CLI can do the same job, as long as they can run commands in your terminal.
Here’s how the work splits.
| The agent can do | You still do |
|---|---|
| Back up your current DNS records | Turn on 2-Step Verification |
| Remove the old MX and SPF records | Create the app password |
| Turn on Email Routing and create the hello@ rule | Add the address in Gmail’s Send mail as |
| Add Google to your SPF record | Click the confirmation link |
| Check the new records are live | Send a test email from another account |
To start, log in to Cloudflare’s command-line tool, or give the agent an API token limited to your domain’s DNS and Email Routing. Then describe the job in plain words.
Set up [email protected] to forward to my Gmail with Cloudflare Email Routing.
Back up my DNS records first, and ask me before you delete anything.
Two habits kept mine safe. I asked for a backup before any record was deleted. And when the agent wanted to change a record I hadn’t asked about, it stopped and asked me first.
One rule matters more than the rest. Never paste your app password into the chat. The agent doesn’t need it, because that password belongs in Gmail and nowhere else.
FAQ
Is Cloudflare Email Routing really free?
Yes. Email Routing is free on every Cloudflare plan, including the free one. The only cost is your domain itself.
Does this work in the Gmail app on my phone?
Yes. Once the address is set up on a computer, it appears in the From menu in the Gmail app too. You can’t add it from the app, though, so do the setup on a computer first.
Can I have more than one address, like contact@ or invoices@?
Yes. Create another routing rule in Cloudflare for each address, then add each one in Gmail’s Send mail as. Cloudflare also offers a catch-all rule that forwards mail sent to any address on your domain.
Does Cloudflare keep a copy of my emails?
Cloudflare says Email Routing forwards mail without storing it. Your messages live in Gmail, the same as the rest of your mail.
Will my emails land in spam?
Mine haven’t so far, with Google in my SPF record and a relaxed DMARC policy. A first message to someone new is the most likely to get flagged, so ask them to check spam if they don’t see it.
Can I use this with Outlook or another email provider?
Cloudflare can forward to any inbox, so the receiving half works anywhere. The sending half in this guide is specific to Gmail. Other providers have their own way of sending from another address, if they offer one.
A Professional Email for the Price of Nothing
A custom domain email with Gmail took me one sitting, three mistakes and zero money. Clear your old mail records, forward the address with Cloudflare, create an app password, and use your full Gmail address as the username. Most of the frustration lives in those last two steps, and now you know where it is.

If you want to see it working, my contact page now shows [email protected]. Send me a note, and you’ll get the reply from it.


Comments
No comments yet. Start the conversation.
How I use your information