Solved: How-To Use Gmail SMTP to Send FROM an Email Address which uses Cloudflare Email Routing

Send emails using Gmail SMTP from an email address which is routed through Cloudflare. You CAN Use your Gmail account as an outbound mail server

which links to…

1 Like

STEP 1. Make sure you have 2FA enabled

For this method to work, you need to have two factor authentification enabled for your Google account. If it’s not, follow the link below and set it up → Enable 2FA in your Google account

STEP 2. Also in your Google account, create an App Password for MailCreate an App Password… (You will copy and use this password later along with your Gmail address in the Google SMTP server settings “Add another email address” form)…

Select “Mail” for the app. Select your computer as the device. Hit “Generate”. Copy and keep the generated password for later in this process.
.
STEP 3. Then, back in Gmail, add your Cloudflare-routed email address

In Gmail go to Settings → Accounts → Send mail as. Under that section, click on Add another email address and fill in the first form with your name and your Cloudflare-routed email address. Untick “Treat as an alias” and click Next Step >>

STEP 4. Fill in the next form

SMTP Server: smtp.gmail.com Port: 587
Username: your gmail address (incl. @gmail.com)
Password is the App Password you generated in Step 2.
Leave TLS enabled
Click Add Account >>

You will receive an email from Gmail asking you to confirm ownership with a code. Enter the code in the dialog (or click the link provided in the confirmation email), and you are all set!

Now you can select your new email address in the list when you compose a new message in Gmail. And, when reply to an email you received at your new address, the new address should be pre-filled in the From: field.

1 Like

If you’re going to be sending e-mail from Google’s SMTP servers, you’d likely want to update your SPF TXT-record to incorporate include:_spf.google.com as well. For example:

v=spf1 include:_spf.mx.cloudflare.net include:_spf.google.com ~all
2 Likes

Yes, thank you @jwds1978 for clarifying this!

The DNS records for your domain on Cloudflare (the one for which you have set up the Email Routing) – that domain – should have a TXT record with the SPF policy. It looks like this (where in this example I have Email Routing set up for my domain on Cloudflare, denverit.com):

In order to authorize the Gmail SMTP Servers, so that you can send emails from your Gmail email account using your Cloudflare-routed email addresses, you need to replace the the Content in this DNS TXT record entry with…

v=spf1 include:_spf.google.com include:_spf.mx.cloudflare.net ~all

Then click the Save button.

1 Like

If in STEP 4. I was using a Yandex MX for a domain.com (before turning on the CF routing to a [email protected] account) So, if I use the generated password for the @domain.com Gmail alert isn’t able to login. So I need to Sign in with Yandex Password (because is my email provider before activating the Cloudflare routing). then I get the confirmation code because the routing is working, and I add the SPF1 as below. I try now but I think is going to be marked as spam.

about Dkim and MX not found…
Do I need to add google MX in Cloudflare? (I think not otherwise will be a conflict.
Please advise. Thanks