Setup to receive emails
- In your Cloudflare dashboard, go to Websites > your website > Email.
Add records and enableand 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
email@example.com. This will forward emails to
firstname.lastname@example.org expected. You’ll need to verify this email before Cloudflare accepts it.
- Add a new custom address like
Send to an emailaction 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
v=DMARC1; p=none; rua=mailto:email@example.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 the
Send email assection. Pick your name, untick
Treat 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.
firstname.lastname@example.org), 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
email@example.com will be visible in the email header, in case this is important to you.
More detailed info on this topic here.