These instructions are for users who are hosting their domain on Cloudflare and would like to change their MX (mail exchange) records so they can send and receive mail with Fastmail.
Note: Changing your MX records is the only way to use a Cloudflare-hosted domain with your Fastmail account, as Cloudflare automatically assigns nameservers to domains and these assignments cannot be changed.
This guide covers three steps to setting up your domain:
- Step 1: Add your domain to Fastmail
- Step 2: Edit your MX records in Cloudflare
- Step 3: Set up DKIM and SPF
Step 1: Add your domain to Fastmail
We have a domain setup wizard to help you get your domain working as quickly and easily as possible.
After you have activated your domain at Cloudflare, you can get to our setup wizard using these steps:
- Log in to your Fastmail account and go to the Settings → Domains screen.
- Click Add or buy domain, then select Use a domain you already own.
- Enter your domain into the text box and click Continue.
Follow the steps in the setup wizard to add your domain and email addresses to Fastmail. If your domain is active at Cloudflare, the setup wizard should detect this. You can also choose Cloudflare from our list of supported registrars.
For more information, please see our Using the domain setup wizard help page.
Please note: If you are on a legacy plan, the domain setup wizard can only set up email addresses, not users. You will need to add users manually in order to create additional user accounts at your custom domain.
Step 2: Edit your MX records in Cloudflare
Note: We recommend making these changes at a time that you do not expect much mail to be sent to your domain.
- Log in to your account at Cloudflare and find the domain you would like to use with Fastmail. In the menu at the top of the screen, click DNS, then Records.
- Click Add Record, then choose MX for the Type.
- Enter your MX record with the following details:
| Name | Mail server | Priority |
|---|---|---|
| @ | in1-smtp.messagingengine.com |
10 |
4. Then add a second MX record with the following details:
| Name | Mail server | Priority |
|---|---|---|
| @ | in2-smtp.messagingengine.com |
20 |
Leave the TTL as the default.
Please make sure that these two MX records are the only MX records present on the domain. Any other MX records should be removed.
Step 3: Set up DKIM and SPF
Your domain should now be ready to receive messages. In order to make sure your sent messages reach your recipients, there are a couple more records to add in your Cloudflare account.
Set up DKIM
- In your DNS control panel, click Add New Record.
- Add three new records, all with the type
CNAME. - Enter the following information (make sure to replace
{mydomain.com}with your actual domain name).
| Type | Name | Target |
|---|---|---|
| CNAME | fm1._domainkey |
fm1.{mydomain.com}.dkim.fmhosted.com |
| CNAME | fm2._domainkey |
fm2.{mydomain.com}.dkim.fmhosted.com |
| CNAME | fm3._domainkey |
fm3.{mydomain.com}.dkim.fmhosted.com |
4. For each record, under Proxy status, click the orange cloud icon so it turns grey. This will turn off CNAME flattening. Note: If you are on a paid Cloudflare plan, you may need to disable CNAME flattening for your domain by logging in to Cloudflare, navigating to DNS > Settings, and changing the dropdown that says Flatten CNAME at apex.
You can leave any other CNAME records you have for your domain where they are.
Set up SPF
- In your DNS control panel, click Add New Record.
- In the drop down for the record type, choose
TXT. - Enter the following information:
| Type | Name | Content |
|---|---|---|
| TXT | @ |
v=spf1 include:spf.messagingengine.com ?all |
Check your domain
Once you have finished this step, your domain should be working with Fastmail.
To check that all your settings are correct, log in to your Fastmail account and go to the Settings → Domains screen. Click Recheck DNS. Your domain should now say Active. MX records set.