Setup to receive emails
- In your Cloudflare dashboard, go to Websites > your website > Email.
- Click
Add records and enable
and Cloudflare will automatically set up the MX and TXT records as needed. We will make some modifications to them soon. - Add a destination address where emails should be forwarded to. I tend to use Gmail's address variation and use something like
username+mydomain@gmail.com
. This will forward emails tousername@gmail.com
as expected. You'll need to verify this email before Cloudflare accepts it. - Add a new custom address like
hello@mydomain.com
with theSend to an email
action and the preferred destination.
This is enough to start receiving emails. If you'd like to send emails from the custom domain as well, continue with the following section.
Setup to send emails
- Add a new DNS TXT record with name
_dmarc
and contentv=DMARC1; p=none; rua=mailto:hello@mydomain.com
. This tells email servers what to do when senders can't be verified and the report will be sent to the specified address. - Cloudflare should have added another TXT record where the content value contains
v=spf1 ...
. Edit this record to enable Gmail to send emails on our behalf. The content should look like this:v=spf1 a mx include:_spf.google.com include:_spf.mx.cloudflare.net ~all
. - In your Google account, under Security, create a new App Password for the Mail app. Save the generated password to use in a later step.
- In your Gmail settings, under
Accounts and import
, add another email address to theSend email as
section. Pick your name, untickTreat as an alias
, and use the custom domain email address in both email and reply-to address fields. - In the next window, set SMTP server to
smtp.gmail.com
, leave port unchanged, add your gmail username (e.g.username
fromusername@gmail.com
), and the app password from earlier.
When composing an email from Gmail after this point, you should have the option to pick your custom domain address as a sender.
Note: your original username@gmail.com
will be visible in the email header, in case this is important to you.
More detailed info on this topic on Jay Caines-Gooby's blog.
Top comments (0)