0xnhl

Fixing Outbound Mail: Adding Resend SMTP to Cloudflare and Gmail

/ Update
4 min read
Learn how to fix DKIM alignment failures and bypass spam filters on your custom domain emails. This guide covers setting up Resend as a free outbound SMTP relay paired with Cloudflare and Gmail for 10/10 inbox deliverability.

This is a follow-up to our previous guide on Creating Unlimited Free Custom Domain Emails with Cloudflare & Gmail

If you followed the first guide, you now have a professional custom domain email (e.g., hello@yourdomain.com) receiving mail seamlessly into your personal Gmail inbox via Cloudflare Email Routing. For incoming mail, the setup is a total win: it’s free, robust, and clean.

However, the moment you try to reply or compose a new email from that address using Gmail’s standard free SMTP configuration, you run into a major roadblock: DKIM Alignment Failure.

Because Gmail’s free SMTP servers send emails on behalf of gmail.com while your “From” header says yourdomain.com, strict spam filters (like Yahoo, Outlook, and corporate firewalls) immediately flag the message as spoofing. Your emails will either land straight in the spam folder or get silently dropped.

To fix this once and for all without paying for Google Workspace, we need an outbound SMTP relay.

Comparing the Best Free Outbound SMTP Relays#

When routing outbound mail for a custom domain, you need a provider that lets you add custom DKIM and SPF records to your DNS so your emails look entirely authentic. Here is how the top free options stack up:

FeatureSMTP2GOResendBrevo
Monthly Free Volume1,000 emails3,000 emails~9,000 emails
Daily Limit200 emails100 emails300 emails
Log Retention5 days30 days30 days
Platform FocusPure SMTP / IT AdminAPIs / DevelopersNewsletters / Marketers
Ease of Setup⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐

Step-by-Step Setup: Integrating Resend with Cloudflare & Gmail#

By plugging Resend into your workflow, you completely solve the DKIM alignment issue and guarantee 100/100 deliverability.

Step 1: Add Your Domain to Resend#

First, authorize Resend to send mail on behalf of your custom domain.

  1. Sign up for a free account at Resend.com.
  2. Go to Domains in the left sidebar and click Add Domain.
  3. Type in your custom domain (e.g., yourdomain.com), leave the region on default (us-east-1), and click Add.

Step 2: Configure Cloudflare DNS (DKIM & SPF Alignment)#

Resend will supply a few specific DNS records. Head over to your Cloudflare dashboard and add them to your DNS settings. (Resend may also prompt you for an auto-configure option which will automatically fill those DNS records in Cloudflare)

  • MX Record: Used for Return-Path bounces (usually mapped to a subdomain like bounces.yourdomain.com so it doesn’t conflict with your Cloudflare Email Routing).

  • TXT Record (SPF): Authorizes Resend’s servers.

  • TXT Record (DKIM): Your cryptographic public key (starts with resend._domainkey).

  • Important Rule: Ensure the Proxy status (the orange cloud) is toggled to Off (DNS Only) for all email-related records.

  • DNS Cleanup: Do not have multiple SPF records. If your root domain already has an SPF record for a specific name from a previous setup, edit it rather than creating a new one. Remove any old Google SPF entries (include:_spf.google.com) since Google is no longer sending your outbound mail.

Once added, click Verify Domain in Resend. It should turn green almost instantly or wait until it shows status verified.

Step 3: Generate Your SMTP API Key#

Because Resend is API-first, your SMTP password is simply an API key.

  1. Navigate to API Keys in your Resend dashboard and click Create API Key.
  2. Name it something descriptive like Gmail SMTP Relay.
  3. Set permissions to Sending access for your verified domain and click Add.
  4. Copy the key immediately (it starts with re_...). Resend will never show it to you again.

Step 4: Wire Up Gmail “Send Mail As”#

Now, we configure Gmail to route outbound mail through Resend instead of Google’s default servers.

  1. Open Gmail, click the gear icon (⚙️) -> See all settings, and head to the Accounts and Import tab.
  2. Under Send mail as, click Add another email address.
  3. Enter your display name and your custom domain address (hello@yourdomain.com).
  4. Uncheck the box that says Treat as an alias. If you leave this checked, people receiving your replies will see a confusing “sent via gmail.com” warning. Click Next Step.
  5. Fill out the SMTP configuration precisely like this:
    • SMTP Server: smtp.resend.com
    • Port: 465 (or 587)
    • Username: resend (type the literal word “resend”)
    • Password: Paste your Resend API Key (re_...).
    • Connection: Secured connection using SSL (for port 465) or TLS (for port 587).
  6. Click Add Account.
  7. Gmail will fire a confirmation code to your custom address. Because your Cloudflare Email Routing is already active, that code will drop straight into your Gmail inbox. Copy it, paste it into the prompt, and hit Verify.

Step 5: Test and Verify Deliverability#

Never assume an email setup works until you test it.

  1. The Technical Test: Go to Mail-Tester.com. Compose a new email from your custom domain inside Gmail and send it to the temporary address Mail-Tester gives you. A healthy Resend + Cloudflare configuration will score a 10/10, confirming your SPF, DKIM, and DMARC alignment are pristine.
  2. Real-World Placement: If you want deeper analytics on how strict corporate firewalls or Microsoft/Yahoo filters view your domain, run a seed-test through GlockApps to verify your inbox placement rate.

With this pipeline in place, you now have a fully functional, highly professional custom domain email architecture that sends and receives mail flawlessly, all for $0/month.

Fixing Outbound Mail: Adding Resend SMTP to Cloudflare and Gmail
https://nahil.xyz/vault/posts/custom-domain-emails-pt2/
AuthorNahil Rasheed
Published atJuly 23, 2026
CopyrightCC BY 4.0
DisclaimerThis content is provided strictly for educational purposes only.