Set up Gmail with Cloudflare Email Routing

Forward custom-domain email to Gmail with Cloudflare Email Routing, then set up SendAs to send from the same address.

Before you start

You’ll need a domain using Cloudflare DNS, access to its Cloudflare dashboard, a Gmail inbox, and Chrome. This guide uses hello@yourdomain.com as the example address.

Forward incoming mail to Gmail

  1. In Cloudflare, go to Compute → Email Service → Email Routing. Choose Onboard Domain, select your domain, review the proposed DNS records, and select Done. If another service handles incoming mail for this domain, plan that migration before replacing its MX records.
  2. Cloudflare adds MX records at the root for inbound mail, a root SPF TXT record authorizing _spf.mx.cloudflare.net, and a DKIM TXT record at the selector it provides, such as cf2024-1._domainkey. Use the MX hosts and priorities Cloudflare assigns. If you already publish SPF at the root, combine the authorization mechanisms in one SPF record.
  3. Open Destination Addresses, submit your Gmail address, then open Cloudflare’s verification email and choose Verify email address.
  4. In Email Routing, open your domain, choose Routing Rules → Create routing rule, and enter hello in Email pattern. Under Action, choose Send to an email. Select your verified Gmail under Destination and choose Save.
  5. From a different mailbox, send a message to hello@yourdomain.com and check your Gmail inbox or spam folder for the forwarded message.

Cloudflare documentation: routing setup and DNS records.

Set up sending

Choose a supported sending provider. This example uses Resend.

  1. In Resend, open Domains and use Add Domain to add the domain after the @ in your custom address.
  2. At your DNS host, add the records Resend shows for sending, using the exact names, types, and values in its Records tab. Keep your forwarding MX records in place. Resend’s sending records use separate hostnames.
  3. In Resend, choose Verify DNS Records and wait until sending is verified.
  4. In API Keys, choose Create API Key, select Sending access, and limit the key to the domain you just verified. Copy the key for SendAs settings.

Resend documentation: domain verification and API key permissions.

Connect SendAs and test

  1. Install SendAs for Gmail in Chrome and open SendAs settings.
  2. Under Add an address, enter hello@yourdomain.com (using your actual domain), choose Resend as the Sending provider, paste the API key, and click Save.
  3. Review the Check DNS results after saving. If you update your DNS, choose Check again. Compare any flagged records with the provider dashboard before editing DNS. Resend can assign CNAMEs for sending where the SendAs checker expects TXT and MX records.
  4. Click Next or choose Send test beside your saved address. Enter an address you can check in Test recipient, choose Send test, and confirm delivery in that inbox.
  5. In Gmail, select Compose, choose your custom address in the SendAs From bar, and send a message.

Organize your sent copies in Gmail

In SendAs settings, enter your Gmail address under Keep a copy in Gmail: BCC this address. In Gmail, create a filter for from:hello@yourdomain.com. Choose Skip the Inbox (Archive it) and Apply the label with a label such as Sent (domain).