Blog/Guide

How to set up custom domain email in Gmail

Send and receive as you@yourdomain.com from your existing Gmail inbox. No Google Workspace, no new app, no migration. Just your domain, your Gmail, and 30 minutes of DNS work.

Mohit Gaddam12 min read

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:

  1. A custom domain - Any domain from any registrar works. Namecheap, Google Domains, GoDaddy, Porkbun - doesn't matter.
  2. 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.
  3. A Gmail account - The free personal Gmail works perfectly. This is where you'll read and send your custom domain email.
  4. 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

  1. Log into the Cloudflare dashboard
  2. Select your domain
  3. Go to Email Email Routing
  4. 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:

MX Records (added by Cloudflare)
MXisaac.mx.cloudflare.net (Priority: 84)
MXlinda.mx.cloudflare.net (Priority: 8)
MXamir.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.com to 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:

ProviderFree tierBest for
Brevo (Sendinblue)300 emails/dayEasiest setup
Mailgun1,000 emails/month (3 months)Developers
Amazon SES62,000 emails/month (from EC2)High volume
SMTP2GO1,000 emails/monthReliability

Sign up for one, verify your domain, and note the SMTP credentials (server, port, username, password).

Step 2: Add "Send mail as" in Gmail

  1. Open Gmail → Settings (gear icon) → See all settings
  2. Go to the Accounts and Import tab
  3. Under "Send mail as", click Add another email address
  4. Enter your name and custom domain email (e.g. hello@yourdomain.com)
  5. Uncheck "Treat as an alias" if you want separate reply-to behavior
  6. Enter your SMTP server details:
SMTP Configuration (example: Brevo)
Serversmtp-relay.brevo.com
Port587
Useryour-brevo-login@email.com
Passyour-smtp-key-here
  1. Select TLS (port 587) or SSL (port 465) for encryption
  2. Click Add Account - Gmail sends a verification email
  3. 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:

SPF Record
TypeTXT
Name@
Valuev=spf1 include:_spf.brevo.com include:_spf.mx.cloudflare.net ~all

Important: 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:

DKIM Record (example: Brevo)
TypeTXT
Namemail._domainkey
Valuev=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:

DMARC Record
TypeTXT
Name_dmarc
Valuev=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com; pct=100

Start 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:

Email Headers (what you want to see)
SPFPASS
DKIMPASS
DMARCPASS

If 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 setupSendMailAs
Setup time30-60 minutes5 minutes
DNS records6-8 manual recordsAutomatic
SMTP providerSeparate signup requiredBuilt in
DKIM signingDepends on SMTP providerAutomatic
MonitoringNone (manual checks)Continuous
CostFree (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.