How to Configure MX Records for Email is an essential skill for website owners, developers, freelancers, and business administrators who want to connect a custom domain with an email service. MX records tell mail servers where they should deliver incoming email for your domain.
For example, if your website uses example.com and you want to receive email at hello@example.com, your domain needs correctly configured MX records pointing to the mail servers responsible for handling your email.
Learning How to Configure MX Records for Email is relatively simple once you understand DNS, mail servers, priorities, and the difference between your website server and email server.
This beginner-friendly tutorial explains How to Configure MX Records for Email step by step. You will learn what MX records are, how they work, how to find the correct MX values from your email provider, how to add them in cPanel and Cloudflare, how to verify them, how to avoid common mistakes, and how MX records work with SPF, DKIM, and DMARC.

What Is an MX Record?
Before learning How to Configure MX Records for Email, you need to understand what MX means.
MX stands for Mail Exchange. An MX record is a DNS record that identifies the mail servers responsible for receiving email for a domain.
For example:
example.com
↓
MX Record
↓
Mail Server
↓
hello@example.com
When someone sends an email to hello@example.com, the sending mail server looks up the MX records for example.com.
The MX records tell the sending server which mail server should receive the message.
The IETF MX record specification provides technical information about how mail delivery works.
Understanding this process is the foundation of How to Configure MX Records for Email.
Why Are MX Records Important?
Learning How to Configure MX Records for Email is important because incorrect MX records can prevent your domain from receiving email.
Proper MX configuration helps:
- Route incoming email
- Connect your domain to an email provider
- Direct mail to the correct servers
- Support business email addresses
- Prevent mail delivery failures
- Maintain reliable email communication
For example, if your domain is configured to use Google Workspace but its MX records still point to an old hosting provider, incoming email may continue going to the old mail system.
Similarly, deleting all MX records accidentally can prevent other mail servers from knowing where to deliver messages.
How Do MX Records Work?
The basic process looks like this:
Sender
↓
Recipient Domain
↓
DNS MX Lookup
↓
MX Record
↓
Mail Server
↓
Recipient Inbox
Suppose a sender wants to send:
hello@example.com
The sending mail server checks the DNS records for:
example.com
It finds the MX records and then connects to the appropriate mail server.
This is why How to Configure MX Records for Email is primarily a DNS configuration task.
MX Record Structure
An MX record normally contains several important fields:
Type: MX
Name: @
Priority: 10
Mail Server: mail.example.com
The main components are:
Type
The record type is:
MX
Name or Host
For the root domain, DNS providers commonly use:
@
However, some providers automatically use the domain name itself.
Priority
The priority is a number associated with the mail server.
Lower numbers generally indicate higher preference.
For example:
Priority 10
Priority 20
Priority 30
The server with priority 10 is generally preferred over the server with priority 20.
Mail Server
This is the hostname of the mail server that receives email.
For example:
mail.example.com
Your email provider will give you the correct hostname.
What Do You Need Before Configuring MX Records?
Before starting How to Configure MX Records for Email, collect the following information:
- Your domain name
- DNS management access
- Email provider name
- Email provider’s MX records
- MX priorities
- Existing MX records
- Email account information
Your email provider should provide the exact MX records you need.
Do not invent MX hostnames.
For example, if your provider tells you to use:
mail.provider.example
do not replace it with:
mail.example.com
unless your provider specifically instructs you to do so.
Step 1: Identify Your Email Provider
The first step in How to Configure MX Records for Email is identifying which service handles your email.
Common examples include:
- Google Workspace
- Microsoft 365
- cPanel email
- Zoho Mail
- Private mail servers
- Business email providers
Your website hosting provider and email provider do not necessarily have to be the same company.
For example:
Domain → Registrar
DNS → Cloudflare
Website → Hosting Company
Email → Google Workspace
In this situation, you must modify DNS records in Cloudflare, while Google Workspace provides the required mail-server information.
Step 2: Find Your DNS Provider
Next, determine where your domain’s DNS records are managed.
Log in to your domain registrar or DNS provider.
Look for options such as:
DNS Management
Manage DNS
DNS Records
Zone Editor
DNS Zone
You may see records such as:
A
AAAA
CNAME
MX
TXT
NS
If you cannot find the DNS management section in your hosting account, your domain may use nameservers from another provider.
Always make DNS changes at the provider managing your authoritative DNS zone.
Step 3: Check Existing MX Records
Before adding new records, check whether your domain already has MX records.
For example:
example.com MX 10 mail.oldprovider.com
There may be multiple records.
For example:
example.com MX 10 mail1.example.com
example.com MX 20 mail2.example.com
Do not automatically delete existing MX records.
First determine what they are used for.
If you are migrating email from one provider to another, old MX records may need to be replaced with the new provider’s records.
If you accidentally keep incompatible old records, some messages could be delivered to the wrong mail system.
Checking existing records is one of the most important steps in How to Configure MX Records for Email.
Step 4: Get the Correct MX Records From Your Email Provider
Your email provider should provide the exact MX records required for your domain.
The records may look like:
Type: MX
Name: @
Priority: 10
Target: mail.example-provider.com
Some providers require multiple MX records.
For example:
Priority 10 → mx1.example-provider.com
Priority 20 → mx2.example-provider.com
Do not copy MX records from another website.
Different providers use different mail servers.
The safest approach to How to Configure MX Records for Email is to use the current official instructions from your email provider.
Step 5: Add the MX Records
Open your DNS management panel and select Add Record.
Choose:
Type: MX
For the hostname, use the value specified by your DNS provider.
For the root domain, it is often:
@
Then enter the priority and mail-server hostname.
For example:
Type: MX
Name: @
Priority: 10
Target: mx1.example-provider.com
Save the record.
If your email provider gives you multiple MX records, add each one separately.
For example:
MX @ 10 mx1.example-provider.com
MX @ 20 mx2.example-provider.com
The exact values must come from your email provider.
Step 6: Remove Old MX Records When Appropriate
If you are moving email from one provider to another, you may need to remove the old MX records.
For example, suppose your domain currently uses:
MX 10 old-mail.example.com
and you are migrating to a new email provider.
The new provider might instruct you to use:
MX 10 mx1.new-provider.com
MX 20 mx2.new-provider.com
After confirming the migration plan, the old MX record may need to be removed.
However, do not remove records without understanding the consequences.
If your old mail system is still required during a migration, changing MX records too early can interrupt email delivery.
Step 7: Verify Your MX Records
After completing How to Configure MX Records for Email, verify that the records are publicly visible.
You can use DNS lookup tools or command-line utilities.
Using dig
On Linux or macOS:
dig MX example.com
You can also use:
dig +short MX example.com
The output may look like:
10 mx1.example-provider.com.
20 mx2.example-provider.com.
Using nslookup
On Windows:
nslookup -type=MX example.com
You should see the MX records configured for your domain.
Verification is an important part of How to Configure MX Records for Email because it confirms that the public DNS system can see your configuration.
MX Record Priority Explained
MX priority is one of the most confusing parts of How to Configure MX Records for Email for beginners.
Consider:
Priority 10 → mail1.example.com
Priority 20 → mail2.example.com
The lower number has higher preference.
In general:
10 = higher preference
20 = lower preference
30 = lower preference
If multiple MX records exist, the sending mail server uses the MX records according to their preference values.
This can provide redundancy when a provider supplies multiple mail servers.
Do not change the priority values unless you understand the provider’s instructions.
Can You Have Multiple MX Records?
Yes.
Many email providers use multiple MX records for redundancy.
For example:
MX 10 mx1.example.com
MX 20 mx2.example.com
MX 30 mx3.example.com
The exact number of MX records depends on the provider.
Multiple MX records do not necessarily mean that all servers receive email equally. Their preference values influence how sending mail servers select destinations.
Always follow your provider’s recommended configuration.
How to Configure MX Records for Email in cPanel
If your DNS is managed through cPanel, you can usually manage MX records through the Zone Editor.
Log in to cPanel.
Go to:
Domains → Zone Editor
Select your domain and choose Manage.
Find the MX section or add a new MX record.
For example:
Name: example.com
Priority: 10
Destination: mail.example.com
The exact interface depends on your hosting provider.
If your email is hosted on the same cPanel server, the provider may already have configured the correct MX record automatically.
Do not replace existing cPanel mail records unless you are intentionally changing email providers.
How to Configure MX Records for Email in Cloudflare
If Cloudflare manages your DNS, log in to Cloudflare and select your domain.
Open:
DNS → Records
Choose:
Add record
Select:
Type: MX
Enter the mail server hostname and priority supplied by your email provider.
For example:
Type: MX
Name: @
Mail server: mx1.example-provider.com
Priority: 10
Save the record.
Cloudflare’s interface may change over time, so check its current documentation if the options differ.
Remember that Cloudflare may manage your DNS while your actual email service is provided by another company.
How to Configure MX Records for Google Workspace
If you use Google Workspace, Google provides specific MX records for Gmail.
Google’s current documentation should always be used for the exact values because providers can change infrastructure and recommended configurations.
The general process is:
- Open your DNS management panel.
- Locate existing MX records.
- Remove or replace old records when appropriate.
- Add the MX records specified by Google.
- Save the changes.
- Return to Google Workspace administration.
- Verify your domain.
- Test incoming and outgoing email.
See the official Google Workspace MX record documentation for current configuration instructions.
Do not use outdated MX values copied from an old tutorial.
How to Configure MX Records for Microsoft 365
Microsoft 365 also provides domain-specific MX information.
The exact MX destination is associated with your Microsoft 365 environment.
The general process is:
- Open the Microsoft 365 admin center.
- Select your domain.
- Find the DNS configuration instructions.
- Copy the MX record provided for your domain.
- Open your DNS provider.
- Add or update the MX record.
- Remove obsolete mail records when appropriate.
- Verify the domain.
- Test email delivery.
Microsoft provides current guidance in its official Microsoft 365 DNS documentation.
Always use the exact MX value Microsoft provides for your domain.
How to Configure MX Records for Zoho Mail
If you use Zoho Mail, Zoho provides MX records that direct incoming mail to its mail infrastructure.
The process is similar:
DNS Provider
↓
Add Zoho MX Records
↓
Verify Domain
↓
Create Mailboxes
↓
Test Email
Use Zoho’s current documentation for the exact MX hostnames and priorities.
The official Zoho Mail documentation provides current instructions.
MX Records and Website Hosting
A common beginner misconception is that MX records control your website.
They do not.
Your website may use:
A Record → Web Server
while email uses:
MX Record → Mail Server
For example:
example.com
↓
A Record
↓
Website Server
example.com
↓
MX Record
↓
Email Server
This means you can move your website to a new hosting company without changing your email provider, provided you keep the appropriate DNS records.
Understanding this distinction is essential when learning How to Configure MX Records for Email.
MX Records and A Records
An A record maps a hostname to an IPv4 address.
For example:
example.com → 203.0.113.10
An MX record identifies a mail server hostname.
For example:
example.com → MX → mail.example.com
The mail hostname itself normally needs to resolve through an appropriate DNS record.
For example:
mail.example.com → A → 203.0.113.20
Your email provider usually handles this infrastructure for you.
MX Records and CNAME Records
MX records should point to mail server hostnames rather than arbitrary CNAME aliases.
When configuring email, follow your provider’s exact DNS instructions.
Do not replace an MX target with a CNAME simply because the CNAME points to the same server.
DNS standards and provider configurations have specific requirements around MX targets.
MX Records and SPF
MX records and SPF records serve different purposes.
MX
MX tells other mail servers:
Where should incoming email for my domain be delivered?
SPF
SPF helps answer:
Which servers are authorized to send email using my domain?
For example:
MX → Receiving email
SPF → Sending authorization
Both can be part of a complete email DNS configuration.
[Internal link: How to Add an SPF Record]
MX Records, DKIM, and DMARC
Modern email authentication often uses multiple DNS records.
A typical setup may include:
MX
↓
Where incoming mail goes
SPF
↓
Authorized sending services
DKIM
↓
Cryptographic email authentication
DMARC
↓
Policy and authentication alignment
Each record has a different purpose.
[Internal link: How to Add DKIM and DMARC Records]
Configuring all of these correctly can improve the reliability and security of your domain’s email infrastructure.
How Long Do MX Changes Take?
DNS changes are not always visible immediately.
After changing MX records, DNS resolvers may continue using cached information until the previous TTL expires.
Depending on the DNS configuration, some systems may recognize the change quickly while others may take longer.
During an email migration, this is particularly important.
Do not assume that every sending mail server will immediately see the new MX records.
How to Test Email After Changing MX Records
After completing How to Configure MX Records for Email, perform a complete email test.
Test Incoming Email
Send an email from an external account to:
hello@example.com
Check whether it arrives in the intended mailbox.
Test Outgoing Email
Send an email from your business mailbox to an external account.
Check whether it arrives successfully.
Test Multiple Providers
If possible, test from different email providers.
For example:
Personal Gmail
Personal Outlook
Business account
This can help identify provider-specific problems.
Common MX Record Errors
When learning How to Configure MX Records for Email, several errors occur frequently.
Email Is Not Arriving
Possible causes include:
- Incorrect MX record
- Wrong priority
- DNS propagation
- Old MX records
- Incorrect mail server
- Email provider configuration problem
Multiple Email Providers Are Receiving Mail
This can happen when old MX records are left in place alongside new records.
Review all existing MX records and remove obsolete records when appropriate.
MX Record Points to the Wrong Server
Check the mail-server hostname against your email provider’s official documentation.
DNS Provider Is Incorrect
You may have added the MX record to a DNS system that is not authoritative for your domain.
Check the domain’s nameservers.
Email Works Sometimes but Not Always
Multiple MX records with different priorities may intentionally provide redundancy. However, incorrect or obsolete records can also cause inconsistent routing.
Review every MX record.
How to Troubleshoot MX Record Problems
If email stops working after changing MX records, follow these steps:
1. Check DNS
Run:
dig MX example.com
Confirm that the expected records appear.
2. Check the Mail Server
Verify that the MX destination belongs to your current email provider.
3. Check Existing Records
Look for old MX records that should have been removed.
4. Check Email Provider Settings
Make sure your domain is verified and mailboxes have been created.
5. Check DNS Propagation
Allow time for DNS caches to update.
6. Send Test Messages
Test incoming mail from an external provider.
7. Review Bounce Messages
If senders receive a bounce message, read the SMTP error code and explanation.
These steps make How to Configure MX Records for Email much easier to troubleshoot.
MX Record Migration Checklist
If you are moving email from one provider to another, use this process:
Old Email Provider
↓
Create Accounts at New Provider
↓
Verify Domain
↓
Configure SPF/DKIM
↓
Prepare New MX Records
↓
Change MX Records
↓
Test Incoming Email
↓
Monitor Delivery
Before changing MX records, make sure the new mailboxes are ready.
Changing MX records before creating the new mailboxes can cause incoming mail problems.
Security Best Practices for MX Records
After learning How to Configure MX Records for Email, follow these practices:
Use Your Provider’s Official MX Values
Never guess mail server hostnames.
Remove Obsolete MX Records
Old records can cause mail to be delivered to outdated systems.
Keep DNS Access Secure
Use strong authentication and multi-factor authentication where available.
Document Your DNS Configuration
Keep a record of why each MX entry exists.
Review DNS Before Email Migration
Make sure the new email provider is ready before changing MX records.
Configure SPF, DKIM, and DMARC
MX records alone do not provide complete email authentication.
Common Mistakes Beginners Should Avoid
When learning How to Configure MX Records for Email, avoid these mistakes.
Deleting MX Records Without a Backup
Always document your existing configuration before making changes.
Using the Wrong Mail Server
Copy the exact hostname provided by your email provider.
Keeping Old MX Records
Remove obsolete records when migrating providers, after confirming the migration plan.
Confusing Website and Email DNS
A website’s A record and email’s MX record have different purposes.
Changing Priority Randomly
Use the priorities specified by your provider.
Testing Only Outgoing Email
A website can send email successfully while incoming email is broken. Test both directions.
Ignoring DNS Propagation
Allow time for DNS caches to update.
MX Record Configuration Checklist
Use this checklist when following How to Configure MX Records for Email:
- Identify your email provider
- Identify your authoritative DNS provider
- Check existing MX records
- Save a copy of the current DNS configuration
- Obtain the correct MX records
- Confirm MX priorities
- Remove obsolete MX records if appropriate
- Add the new MX records
- Save DNS changes
- Verify public MX records
- Confirm the mailboxes exist
- Test incoming email
- Test outgoing email
- Check bounce messages
- Configure SPF
- Configure DKIM
- Configure DMARC
- Monitor email delivery
Frequently Asked Questions
What is an MX record?
An MX record is a DNS record that specifies which mail servers should receive email for a domain.
How to Configure MX Records for Email?
Log in to the DNS provider managing your domain, obtain the correct MX values from your email provider, add the required MX records with their specified priorities, remove obsolete records when appropriate, and test email delivery.
Can I have multiple MX records?
Yes. Email providers commonly use multiple MX records for redundancy and availability.
What does MX priority mean?
MX priority determines mail-server preference. Lower numbers generally have higher preference than higher numbers.
Do MX records affect my website?
Normally, MX records control email routing rather than website traffic. Website traffic is generally handled by records such as A, AAAA, or CNAME records.
Can I use Google Workspace for email and another company for website hosting?
Yes. Your website and email can use completely different providers. Your A or CNAME records can point website traffic to one provider while your MX records point email to another.
How long does it take for MX records to update?
The timing depends on DNS caching and TTL values. Some changes become visible quickly, while others may take longer.
Can I delete old MX records?
If you are migrating email providers and the old records are no longer required, they may need to be removed. However, confirm your migration plan before deleting them.
Do MX records improve email security?
MX records primarily control where incoming email is delivered. They are not an email authentication mechanism. SPF, DKIM, and DMARC provide additional authentication and anti-spoofing capabilities.
Do I need SPF, DKIM, and DMARC with MX records?
For a modern domain email setup, it is generally recommended to configure appropriate SPF, DKIM, and DMARC policies in addition to MX records.
Useful External Resources
For the technical email transport standard, see the IETF RFC 5321 documentation.
For Google Workspace MX configuration, use the official Google documentation.
For Microsoft 365 DNS configuration, see the official Microsoft documentation.
For Zoho Mail MX configuration, refer to the official Zoho Mail documentation.
These authoritative resources can help you understand How to Configure MX Records for Email and verify provider-specific requirements.
Conclusion
Learning How to Configure MX Records for Email is an important skill for anyone managing a business domain or custom email address.
The process involves identifying your email provider, finding your authoritative DNS provider, checking existing MX records, obtaining the correct mail-server values, adding the records with the appropriate priorities, and testing email delivery.
Remember that MX records control incoming email routing, while SPF helps identify authorized sending infrastructure and DKIM and DMARC provide additional email authentication capabilities.
If you are migrating from one email provider to another, prepare the new mailboxes before changing your MX records and carefully remove obsolete records only when appropriate.
Once you understand How to Configure MX Records for Email, you can confidently connect domains to email services, troubleshoot mail delivery problems, and manage DNS-based email configuration for websites and businesses.






Comments