You can host email accounts for a single custom domain across two different services by using DNS MX records to split traffic. By configuring priority values, you direct incoming mail to specific providers based on recipient address or load balancing needs. This setup requires careful management of Cloudflare’s proxy settings and SPF records to ensure deliverability.
Understanding MX Record Priorities
The core mechanism for routing email is the Mail Exchange (MX) record in your domain’s DNS configuration. Each MX record has a priority value, typically ranging from 0 to 60. Lower numbers indicate higher priority. When an email server attempts to deliver a message to your domain, it queries your DNS and contacts the server with the lowest priority number first. If that server is unreachable, it falls back to the next highest priority.
To use two different services, you must assign different priority levels to their respective MX records. For example, if Service A has a priority of 10 and Service B has a priority of 20, all mail will go to Service A unless it fails. This creates a primary-secondary relationship rather than a true simultaneous dual-hosting scenario for every single address. However, you can achieve more complex routing by using subdomains or aliasing features provided by the email hosts themselves, but at the DNS level, you are managing priorities.
Configuring Cloudflare DNS Settings
Cloudflare acts as a reverse proxy for many DNS records, but MX records should generally not be proxied through Cloudflare’s orange cloud. Proxied MX records can interfere with SMTP connections and cause delivery failures because Cloudflare does not proxy port 25 traffic effectively for most email providers.
When adding MX records in the Cloudflare dashboard, ensure the proxy status is set to "DNS Only" (the grey cloud icon). This ensures that the DNS query returns the actual IP addresses or hostnames of your email providers without passing through Cloudflare’s network. You need to add separate MX records for each service you wish to use.
For instance, if you are using Google Workspace and Microsoft 365, you would add the MX records provided by both services. Set one to priority 10 and the other to priority 20. It is crucial to verify the exact hostname provided by each provider, such as
aspmx.l.google.com or
mail.protection.outlook.com. Incorrect hostnames will result in undeliverable emails.
Managing SPF Records for Multiple Services
Sender Policy Framework (SPF) records prevent spoofing by listing which servers are authorized to send email on behalf of your domain. When using multiple email services, your SPF record must include mechanisms for all of them. If you only list one service, emails sent from the other may be marked as spam or rejected.
An SPF record looks like a TXT record in your DNS settings. To include multiple providers, you use the
include: mechanism. For example:
v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all
This record authorizes both Google and Microsoft servers to send mail for your domain. Note that you can only have one SPF record per domain. If you have existing entries, you must merge them into a single string. Exceeding the 10-lookup limit can cause SPF validation to fail, so be cautious when adding many third-party services.
Routing Specific Emails to Different Inboxes
While MX priorities handle fallback, they do not allow you to send specific user addresses to different services simultaneously under the same domain name (e.g.,
[email protected] going to Service A while
[email protected] goes to Service B) purely via standard MX records. Standard MX routing is domain-wide.
To achieve this, you typically rely on features within the email providers. Many modern email platforms allow you to create aliases or sub-addresses. Alternatively, you can use different subdomains for different services. For example, use
@domain.com for Service A and
@support.domain.com for Service B. This allows you to configure distinct MX records for each subdomain, giving you full control over where each type of email lands.
If you need to route emails based on content or specific local-part rules, you must use the filtering or forwarding capabilities inside the receiving email service’s admin console. Cloudflare does not provide email filtering logic; it only handles DNS resolution.
Troubleshooting Common Issues
Delays in propagation can occur after changing MX records. While Cloudflare updates DNS quickly, global TTLs might still cache old records. Use tools like
dig or online MX checkers to verify the current state.
Another common issue is DKIM alignment. Ensure that both email services have their DKIM keys published in your DNS. Misconfigured DKIM can lead to emails being flagged as suspicious even if SPF is correct. Additionally, check DMARC policies to ensure they are compatible with both providers.
For more details on DNS propagation, see
Do Root TLD DNS Servers Always Respond with IP Addresses and Additional Records?. If you encounter issues where redirects happen instead of forwards, review
Domain Address Redirects Instead of Forwards: Troubleshooting DNS and Cloudflare.
Frequently Asked Questions
Can I receive email for the same address on two services simultaneously?
No, standard MX records prioritize one destination over another. To receive mail in two places, you must set up forwarding or aliasing within one of the email providers to copy messages to the other service.
Why is my email being marked as spam after adding a second provider?
This is often due to an incomplete SPF record. You must update your TXT record to include the
include: mechanism for both providers, ensuring both are authorized to send mail for your domain.
Should I enable the proxy (orange cloud) for MX records in Cloudflare?
No, MX records should always be set to DNS Only (grey cloud). Proxing MX records can break SMTP connections and prevent email delivery because Cloudflare does not proxy the necessary ports for mail servers.
What happens if the primary email server is down?
Email servers will attempt delivery to the primary MX record first. If it times out or rejects the connection, they will automatically try the secondary MX record with the next highest priority number.
How do I split email between departments using one domain?
Use subdomains for different departments, such as
[email protected] and
[email protected]. Configure separate MX records for each subdomain to route them to different email services or groups.