Send and receive email on your own domain
Receive mail at hello@yourdomain.com with Cloudflare Email Routing, and send from the same address inside Gmail using a Google app password. Free, about 15 minutes.
How the three parts fit together
Cloudflare only receives and forwards. Gmail does the sending. You need a domain on Cloudflare and a Gmail account.
Receive
Cloudflare Email Routing forwards hello@yourdomain.com to your Gmail inbox.
App password
A 16 character Google code that lets Gmail send through its own SMTP server.
Send as
Gmail's Send mail as feature, so replies leave from hello@yourdomain.com.
Receive mail with Cloudflare
Replace yourdomain.com and yourname@gmail.com with your own values everywhere.
Open Email Routing
- Sign in at dash.cloudflare.com and select your domain.
- In the left menu open Email, then Email Routing, and press Get started.
Create your custom address
- Under Routes, press Create address.
- Custom address: hello (this becomes hello@yourdomain.com).
- Action: Send to an email. Destination: your Gmail address.
- Save. Cloudflare emails a verification link to that Gmail. Open it and confirm.
hello@yourdomain.com → yourname@gmail.comAdd the DNS records Cloudflare asks for
Cloudflare shows a prompt to add the MX and SPF records. Press Add records and enable. If it reports a conflict, delete the old MX records of your previous mail provider first, then retry.
- Three MX records pointing to Cloudflare's mail servers (route1, route2, route3 under mx.cloudflare.net).
- One SPF TXT record that includes Cloudflare.
Test receiving
From any other account (not the Gmail you forward to) send a mail to hello@yourdomain.com. It should arrive in your Gmail inbox within a minute. Optionally turn on the Catch-all address under Routes to forward every other name at your domain too.
Create a Google app password
Gmail needs this code to send through smtp.gmail.com. Your normal Google password will not work there.
Turn on 2-Step Verification
- Open myaccount.google.com/security.
- Under How you sign in to Google, open 2-Step Verification and finish setup if it is off.
App passwords stay hidden until this is on.
Generate the app password
- Open myaccount.google.com/apppasswords.
- App name: Gmail custom mail. Press Create.
- Copy the 16 character code now. Google shows it only once. Spaces do not matter.
Send from Gmail
Use Gmail's Send mail as so your replies show hello@yourdomain.com.
Open Send mail as
- In Gmail on a computer press the gear, then See all settings.
- Open the Accounts and Import tab.
- Under Send mail as press Add another email address.
Enter your name, address and SMTP details
- Name: your display name. Email address: hello@yourdomain.com.
- Keep Treat as an alias ticked, then press Next Step.
- Fill the SMTP screen with the values below and press Add Account.
| Field | Value |
|---|---|
| SMTP Server | smtp.gmail.com |
| Port | 587 |
| Secured connection | TLS (the default choice) |
| Username | your full Gmail address, yourname@gmail.com, not the custom one |
| Password | the 16 character app password from step 6 |
smtp.gmail.comConfirm with the verification code
Google sends a confirmation mail to hello@yourdomain.com. Cloudflare forwards it to your Gmail inbox, so it arrives within a minute. Click the link in it or type the code into the Gmail window.
Reply from the right address
- Back in Send mail as, choose Reply from the same address the message was sent to.
- Optional: press make default next to hello@yourdomain.com so new mail uses it.
- To send, press Compose and pick the address in the From dropdown.
Send a test to another account and check that the sender shows your custom address.
DNS records for better delivery
Add these in Cloudflare under DNS, then Records. They lower the chance of your mail landing in spam.
| Type | Name | Content |
|---|---|---|
| MX | @ | Three Cloudflare records, added automatically in step 3 |
| TXT (SPF) | @ | v=spf1 include:_spf.mx.cloudflare.net include:_spf.google.com ~all |
| TXT (DMARC) | _dmarc | v=DMARC1; p=none; rua=mailto:hello@yourdomain.com |
v=spf1 include:_spf.mx.cloudflare.net include:_spf.google.com ~allCommon questions
Can Cloudflare Email Routing send mail?
No. It only receives and forwards. That is why sending goes through Gmail's SMTP server with an app password.
Why does Gmail say authentication failed?
Check that the username is your full Gmail address, the password is the app password and not your Google password, and the port is 587 with TLS. Create a fresh app password if unsure.
Is it free?
Cloudflare Email Routing and Gmail are free. You only pay for the domain name.
Can I add more addresses like support@ or admin@?
Yes. Add another custom address in Email Routing, then repeat Part 3 for each one you want to send from.
Does this work on the Gmail phone app?
Setup must be done on a computer, but once added, the From option appears in the app's compose screen.