Contents

Cloudflare Outbound Email

Cloudflare is rapidly rolling out its email forwarding service to those who have signed up for the beta. It is a great way to get an email address on your domain. However, there is one problem. They don’t offer an outbound email server, so there is no way to send email from your domain.

However, you can set up a Gmail account to send email using these addresses.

The basic setup is straightforward. First, you will need request access. After a few days or weeks you will get an email with a link to set up your email forwarding.

Cloudflare Email Setup

Cloudflare email setup. You fill in the addresses to forward to and set up the DNS.

The setup is easy. There are just three steps. Add the destination address. Validate that you own the address. Set up the DNS to make Cloudflare the mail server.

There is one problem. There is no outbound mail. You can receive an email at your custom address, but you can’t reply to an email using that address.

ImprovMX has a method for sending email using Gmail’s SMTP server. It turns out that this method also works with Cloudflare, but it requires a little tweaking.

As ImprovMX mentions, using Gmail to send email over SMTP is legacy functionality in Gmail. It could be deprecated in the future, but as of 02/01/2022, it is working.

  1. You need a Gmail account. Turn on 2FA.

  2. You need an App Password. These passwords are per application credentials and allow you to log into Gmail. This allows Gmail to log into its outbound mail server.

  3. In Gmail, go to Settings/Accounts and under “Send mail as” click on “Add another email address”.

  4. Type in the name and email address you want to use. Uncheck “Treat as an alias.”

  5. It asks for the SMTP server settings. You use “smtp.gmail.com” as the server. The login is your Gmail account. The password is the App Password we created in step 2.

  6. Click on “Add.” Gmail will send an email to the address you just added with a code to verify you have control of the email address. Cloudflare will forward this email back to the email address you set up.

Now you can send email from Gmail. However, your friends will tell your email goes straight to the spam folder. The default Cloudflare SPF policy only lists Cloudflare’s server as a valid sender. Your inbound emails forwarded by Cloudflare will not get treated as spam. For outbound, Gmail is going to need to be a designated sender.

The DNS records for your domain have a TXT record with the SPF policy. You need to update this to “v=spf1 include:_spf.google.com include:_spf.mx.cloudflare.net ~all”. This policy will allow both Gmail and Cloudflare to send emails on your behalf.