DEV Community

Abdiel49
Abdiel49

Posted on

Configure Cloudflare Email Routing with Gmail to Send and Receive Mails

Configure Cloudflare Email Routing

Open: https://dash.cloudflare.com and go to Email → Email Routing, enable Email Routing and create your custom address.

Example:

user@yourdomain.com
→ forwards to
yourgmail@gmail.com
Enter fullscreen mode Exit fullscreen mode

Cloudflare will send a verification email to your Gmail account to confirm the forwarding destination. Open the email and verify it.

Enable Gmail App Passwords

Open https://myaccount.google.com/security and enable 2-Step Verification, then open: https://myaccount.google.com/apppasswords and generate a new App Password for Mail.

Google will generate a password similar to:

abcd efgh ijkl mnop
Enter fullscreen mode Exit fullscreen mode

This will be your SMTP password.

Configure Gmail to Send Emails Using Your Domain

In Gmail go to:

Settings → See all settings → Accounts and Import → Send mail as → Add another email address.

Add: user@yourdomain.com

Add new mail with your domain image

Use this SMTP configuration:

SMTP Server: smtp.gmail.com
Port: 587
Username: yourgmail@gmail.com
Password: YOUR_APP_PASSWORD
TLS: Enabled
Enter fullscreen mode Exit fullscreen mode

Verify the Custom Domain Email

Gmail will send a verification email to: user@yourdomain.com
Cloudflare will forward it to your Gmail inbox automatically.
Open the email and confirm the verification.
Refresh Gmail, now you can send emails as: user@yourdomain.com

Select send email as a

Configure SPF and DMARC

Add these DNS TXT records in Cloudflare.

SPF

  • Host: @
  • Value: v=spf1 include:_spf.google.com ~all

DMARC

  • Host: _dmarc
  • Value: v=DMARC1; p=quarantine;

Top comments (0)