Recently, I worked on a client project where the client purchased a new domain through Cloudflare and needed a complete setup for domain forwarding, a VidSell custom subdomain, custom email forwarding, and Gmail sending from domain-based emails.
At first, it looked like a small domain setup task, but it became a full configuration involving Cloudflare DNS, redirect rules, VidSell custom domain verification, Cloudflare Email Routing, Gmail SMTP, Google App Password, and multiple sender verifications.
In this post, I will explain the full process and the important lessons from this setup.
What the Client Needed
The client needed:
Main domain redirect
Custom subdomain connected to VidSell
Cloudflare DNS setup
Custom domain email forwarding
Gmail sending from custom domain emails
Testing and verification
The goal was simple: the domain, subdomain, and business emails needed to work properly under one professional brand.
Step 1: Set Up the Main Domain Redirect in Cloudflare
One important thing to understand:
DNS cannot redirect a domain to a full URL with a path or query string.
For example, if the destination URL looks like:
https://example.com/e/page?view=community
you cannot do this with only an A record or CNAME record.
For this, you need to use Cloudflare Redirect Rules.
In Cloudflare, I created a redirect rule for:
example.com
www.example.com
and redirected them to the client’s destination URL.
Important lesson: when creating redirect conditions, use OR, not AND, if you want both root domain and www domain to redirect.
Correct logic:
hostname equals example.com
OR
hostname equals www.example.com
Wrong logic:
hostname equals example.com
AND
hostname equals www.example.com
A visitor cannot be on both hostnames at the same time, so using AND will break the redirect rule.
Step 2: Connect the VidSell Custom Subdomain
Next, I connected the custom subdomain to VidSell.
For SaaS platforms like VidSell, the usual setup is a CNAME record.
Example:
Type: CNAME
Name: go
Target: platform-provided-domain.com
Proxy status: DNS only
TTL: Auto
For many third-party platforms, it is better to keep the CNAME as DNS only unless the platform specifically tells you to enable Cloudflare proxy.
After adding the DNS record, I verified the custom domain inside the VidSell workspace.
Step 3: Set Up Cloudflare Email Routing
The client also needed custom domain emails.
I used Cloudflare Email Routing to forward custom domain emails to the client’s Gmail inbox.
Example:
[email protected] → Gmail inbox
[email protected] → Gmail inbox
[email protected] → Gmail inbox
Cloudflare Email Routing is very useful for receiving emails without buying a full mailbox immediately.
But there is one limitation:
Cloudflare Email Routing only handles receiving and forwarding emails. It does not provide outgoing email sending.
So after the receiving setup was complete, the client could receive emails, but sending from the custom domain needed another setup.
Step 4: Configure Gmail to Send from Custom Domain Emails
To allow the client to send emails from the custom domain inside Gmail, I used Gmail’s Send mail as feature.
This required:
Enabling 2-Step Verification
Creating a Google App Password
Adding the custom email inside Gmail
Configuring Gmail SMTP
Verifying each sender address
Testing outgoing emails
The Gmail SMTP setup used:
SMTP Server: smtp.gmail.com
Port: 587
Security: TLS
Username: Gmail address
Password: Google App Password
Important lesson:
Do not use the normal Gmail password for SMTP. Use a Google App Password.
After adding each custom email address in Gmail, Gmail sent a verification email. Since Cloudflare Email Routing was already working, the verification emails arrived in the Gmail inbox, and I completed the verification.
Step 5: Test Everything
After completing the setup, I tested:
Main domain redirect
WWW domain redirect
Custom VidSell subdomain
Email forwarding
Gmail sending from custom domain emails
Verification emails
Everything worked successfully.
Common Problems I Faced
Cloudflare 522 Error
A Cloudflare 522 error can appear when Cloudflare tries to connect to an origin server but the server does not respond.
In this case, the redirect rule needed to be fixed so Cloudflare would redirect the domain instead of trying to load a non-working origin.
Wrong Redirect Rule Logic
Using AND instead of OR in the hostname condition can stop the redirect from working.
Email Receiving vs Sending Confusion
Many clients think custom email forwarding automatically means they can send from the same address. But receiving and sending are two different setups.
Cloudflare handles receiving. Gmail SMTP handles sending.
Final Result
The final setup included:
Cloudflare domain redirect
VidSell custom subdomain connection
Cloudflare DNS records
Cloudflare Email Routing
Multiple custom email forwarding rules
Gmail Send mail as setup
Google App Password setup
SMTP configuration
Full testing
The client can now use the domain, subdomain, and custom domain emails professionally.
What I Learned from This Project
A simple domain task can become a full business setup when domain, SaaS, email receiving, and email sending are all involved.
This is why proper DNS and email configuration is important. A wrong proxy setting, wrong redirect rule, or missing SMTP setup can stop the whole system from working.
For business owners, a proper custom domain and email setup improves trust, branding, and communication.
For freelancers and developers, this is a good reminder to always check the full scope before pricing a project.
Need Help?
If you need help with Cloudflare DNS, domain redirects, custom subdomains, business email setup, Gmail SMTP, Google Workspace, Zoho Mail, or WordPress/Moodle domain configuration, I can help set it up properly and test everything.