TL;DR
You need three things: Cloudflare (free) for email routing, an SMTP relay for sending, and DNS records for authentication. It takes about 30 minutes manually - or 5 minutes with SendMailAs.
What you need before starting
Before you touch any DNS records, make sure you have these ready:
- A custom domain - Any domain from any registrar works. Namecheap, Google Domains, GoDaddy, Porkbun - doesn't matter.
- A free Cloudflare account - You'll use Cloudflare for email routing (receiving mail). Move your domain's nameservers to Cloudflare if they aren't already.
- A Gmail account - The free personal Gmail works perfectly. This is where you'll read and send your custom domain email.
- An SMTP relay service - For sending email from your custom domain. Options include Brevo (free tier), Mailgun, or Amazon SES.
The entire stack is free or nearly free. Cloudflare's email routing is free. Gmail is free. Most SMTP relays have generous free tiers. Compare that to Google Workspace at $7/user/month ($84/year).
Part 1: Receiving email
Route incoming mail from your domain to Gmail
Cloudflare Email Routing catches mail sent to your domain and forwards it to your Gmail. It's free and takes about 5 minutes to configure.
Step 1: Enable Email Routing in Cloudflare
- Log into the Cloudflare dashboard
- Select your domain
- Go to Email → Email Routing
- Click Get started and follow the setup wizard
Cloudflare will automatically add MX records to your domain. These tell other mail servers to deliver email for your domain to Cloudflare:
isaac.mx.cloudflare.net (Priority: 84)linda.mx.cloudflare.net (Priority: 8)amir.mx.cloudflare.net (Priority: 5)Step 2: Create a routing rule
Under Email Routing → Routing rules, create a catch-all or specific address:
- Catch-all: Routes everything (any address @yourdomain.com) to your Gmail
- Specific address: Routes only
hello@yourdomain.comto your Gmail
Enter your Gmail address as the destination. Cloudflare will send a verification email - click the link to confirm.
Heads up: Cloudflare Email Routing adds a "via" header that can cause deliverability issues. The forwarded emails arrive from Cloudflare's servers, not your domain's. This doesn't affect receiving, but it matters when we set up sending in the next section.
Part 2: Sending email
Configure Gmail to send from your custom domain
Receiving is half the equation. You also need to send as you@yourdomain.com. Gmail's "Send mail as" feature lets you do this with an external SMTP server.
Step 1: Set up an SMTP relay
You need an SMTP server that will send email on your domain's behalf. Popular free options:
| Provider | Free tier | Best for |
|---|---|---|
| Brevo (Sendinblue) | 300 emails/day | Easiest setup |
| Mailgun | 1,000 emails/month (3 months) | Developers |
| Amazon SES | 62,000 emails/month (from EC2) | High volume |
| SMTP2GO | 1,000 emails/month | Reliability |
Sign up for one, verify your domain, and note the SMTP credentials (server, port, username, password).
Step 2: Add "Send mail as" in Gmail
- Open Gmail → 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 domain email (e.g.
hello@yourdomain.com) - Uncheck "Treat as an alias" if you want separate reply-to behavior
- Enter your SMTP server details:
smtp-relay.brevo.com587your-brevo-login@email.comyour-smtp-key-here- Select TLS (port 587) or SSL (port 465) for encryption
- Click Add Account - Gmail sends a verification email
- Check your inbox (it routes through Cloudflare to Gmail) and confirm
Once confirmed, you can compose emails in Gmail and choose your custom domain address in the "From" dropdown.
Part 3: Email authentication
SPF, DKIM, and DMARC - the records that keep you out of spam
This is the part most guides skip or get wrong. Without proper authentication, your emails will land in spam. You need three DNS records:
SPF (Sender Policy Framework)
SPF tells receiving mail servers which servers are authorized to send email for your domain. Add a TXT record to your domain's DNS:
TXT@v=spf1 include:_spf.brevo.com include:_spf.mx.cloudflare.net ~allImportant: You can only have one SPF record per domain. If you already have an SPF record, merge the include: statements into the existing record. Multiple SPF records will cause authentication failures.
DKIM (DomainKeys Identified Mail)
DKIM adds a cryptographic signature to your outgoing emails. Your SMTP provider gives you a DKIM record to add to DNS. The specifics vary by provider, but it typically looks like:
TXTmail._domainkeyv=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN...(your key)Your SMTP provider's dashboard will have the exact record. Copy it carefully - a single character mistake breaks DKIM verification.
DMARC (Domain-based Message Authentication)
DMARC ties SPF and DKIM together and tells mail servers what to do when checks fail. Start with a monitoring-only policy:
TXT_dmarcv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com; pct=100Start with p=none (monitoring only), then move to p=quarantine after confirming everything works, and eventually to p=reject for full protection.
Don't skip DMARC. Gmail and Yahoo now require DMARC for bulk senders. Even if you're not sending at scale, missing DMARC hurts your deliverability score and leaves your domain open to spoofing.
Part 4: Testing your setup
Verify everything works before going live
Test receiving
Send an email from a different account (not the Gmail you configured) to you@yourdomain.com. It should arrive in your Gmail inbox within a few minutes.
Test sending
Compose a new email in Gmail. Click the "From" dropdown and select your custom domain address. Send it to a different email account and verify it arrives.
Test authentication
Send an email to a Gmail address and open the email. Click the three dots menu → Show original. You should see:
PASSPASSPASSIf any of those show FAIL, double-check the corresponding DNS record. Common issues:
- SPF FAIL: Missing
include:for your SMTP provider, or multiple SPF records - DKIM FAIL: Typo in the DKIM record, or wrong selector name
- DMARC FAIL: SPF or DKIM (or both) are failing, since DMARC depends on them
That was a lot of DNS records
Or skip all of it in 5 minutes
SendMailAs automates the entire process - DNS records, email routing, SMTP relay, SPF, DKIM, and DMARC. Point your nameservers to Cloudflare and we handle the rest.
The easy way: SendMailAs
Automate everything you just read in 5 minutes
If you've read this far and thought "this is a lot of work" - that's because it is. Every step above has edge cases, provider-specific quirks, and things that can silently break.
I built SendMailAs to automate this entire process. Here's what's different:
Automatic DNS configuration
Point your nameservers to Cloudflare. SendMailAs creates all MX, SPF, DKIM, and DMARC records automatically.
Built-in SMTP relay
No third-party SMTP service needed. SendMailAs runs its own mail server (Haraka) with proper DKIM signing.
No 'via' header problems
Unlike Cloudflare email forwarding, SendMailAs uses a custom Email Worker that preserves original headers and DKIM signatures.
Ongoing monitoring
DNS records break silently. SendMailAs monitors your configuration and alerts you if anything changes.
| Manual setup | SendMailAs | |
|---|---|---|
| Setup time | 30-60 minutes | 5 minutes |
| DNS records | 6-8 manual records | Automatic |
| SMTP provider | Separate signup required | Built in |
| DKIM signing | Depends on SMTP provider | Automatic |
| Monitoring | None (manual checks) | Continuous |
| Cost | Free (with limitations) | Free (1 domain) / $29/yr |
Frequently asked questions
No. Google Workspace ($7/user/month) is one way, but you can also use free email routing services like Cloudflare Email Routing to receive mail, and SMTP relay to send. SendMailAs automates this entire process for free (1 domain) or $29/year (unlimited domains).
Not if you set up SPF, DKIM, and DMARC correctly. These authentication records prove you own the domain. SendMailAs configures all three automatically. Without them, yes - your emails will likely hit spam folders.
Yes. Gmail supports multiple 'Send mail as' identities. You can add as many domains as you want. With SendMailAs Pro, you get unlimited domains for $29/year - compared to $84/year per domain with Google Workspace.
Email forwarding routes incoming mail to your existing inbox (like Gmail). Email hosting gives you a separate mailbox. For most solopreneurs and freelancers, forwarding is all you need - you keep using Gmail and just add a custom 'From' address.
Typically 1-30 minutes for most DNS providers. Cloudflare propagates almost instantly. Some providers can take up to 48 hours, but this is rare. You can verify propagation using dig or online DNS lookup tools.
Yes, but it requires ongoing maintenance. If Cloudflare or your SMTP provider changes anything, you'll need to update records manually. SendMailAs monitors and maintains your configuration automatically.
Ready to set up your custom domain email?
First domain is free forever. No credit card required. Set up in 5 minutes.