MX record cannot point to a CNAME or an IP address
An MX record must contain a hostname (like mail.example.com) that has its own A or AAAA record. If it holds an IP address, or a name that is really a CNAME, email delivery can fail for some or all senders, and the fix is to point the MX at a proper hostname.
An MX record tells the rest of the internet which server receives email for your domain. The value must be a hostname, for example mail.example.com, and that hostname must resolve directly to an IP address through an A (or AAAA) record. Two mistakes break this rule: typing an IP address such as 203.0.113.10 into the MX value, or pointing the MX at a name that is itself a CNAME (an alias to another name). The email standards forbid both. Some mail servers tolerate it and many do not, so the result is often mail that arrives from some senders and bounces from others.
What people see
The symptoms are usually vague, because the DNS record itself looks harmless in the control panel.
- Some people say their email to you bounced, others say it was fine.
- Bounce messages mention that the domain or host was not found, or that no valid mail server could be reached. The exact wording depends on the sender's system.
- Messages from big providers arrive, but messages from company or government servers do not.
- Contact form replies, order notices or password resets never show up.
- Your DNS panel shows a warning, or a mail checker reports an invalid MX target.
Why it matters
Email that bounces is a lost enquiry, a lost order or a customer who assumes you ignored them. Because it often fails only for some senders, it can go unnoticed for weeks. It also looks careless to anyone who runs a mail test on your domain, and it can hide other email problems such as missing MX records or weak sender authentication. This is an email delivery problem, not a ranking factor, so the cost shows up in sales and trust rather than in search results.
How to check if you have it
You can check for free in a few minutes. Replace example.com with your domain.
dig MX example.com +short
On Windows, where dig is not installed, use this instead:
nslookup -type=MX example.com
You will see lines like 10 mail.example.com. The number is the priority and the name is the target. Then look up the target itself:
dig mail.example.com +short
If the answer is only IP addresses, the target is fine. If the first line is another hostname followed by IP addresses, your target is a CNAME and needs fixing.
| What the MX value looks like | Valid? |
|---|---|
10 mail.example.com. and that name has an A record | Yes |
10 203.0.113.10 | No, an IP address is not a hostname |
10 mail.example.com. and that name is a CNAME | No, the target must not be an alias |
10 smtp.google.com. (as given by your provider) | Yes, if it matches what the provider tells you to use |
If you prefer a web page, the MX lookup at MXToolbox and the Dig tool in Google Admin Toolbox both show the same information. Week 10 of SiteMonday (domain, SSL and email deliverability) also looks at your mail records and lists this problem in the ranked fix list if it finds it.
How to fix it
The steps are the same on every platform, only the screens differ.
- Find out who handles your email. It might be Google Workspace, Microsoft 365, your web host or a separate mail service. Ask them, or read their setup page, for the exact MX hostnames and priorities.
- Open the DNS settings where your domain's nameservers point. This is not always your registrar. If your nameservers belong to Cloudflare, for example, edit the records there.
- Delete the invalid MX record.
- Add a new MX record. The name is usually
@(the bare domain), the value is the hostname from your provider, and the priority is the number they give you. - If you run your own mail server, first create an A record such as
mailpointing to the server's IP address, then set the MX value tomail.example.com. Never use a CNAME for this name. - If your MX target was a CNAME, replace it with the final hostname the CNAME points to, or turn that name into a real A record.
- Check that no CNAME exists on the same name as the MX. A name that has a CNAME cannot carry other records, so a CNAME on
@is a conflict.
During the change, mail may briefly go to the wrong place. Sending servers normally retry for a few days, so a short gap is rarely fatal, but make the change in one sitting.
Common platforms
Where things are depends on your version and theme, so look for the names below.
- Cloudflare: DNS, then Records. MX records cannot be proxied, and the A record for a mail hostname must be set to DNS only (grey cloud), or mail clients and servers will reach Cloudflare instead of your mail server.
- cPanel: Zone Editor to edit records, and Email Routing (sometimes called MX Entry) to check the routing setting matches where your mail really lives.
- GoDaddy: DNS Management for the domain, in the records list.
- Namecheap: Advanced DNS tab, plus the Mail Settings dropdown, which can override manual MX entries.
- Plesk: the domain's DNS Settings page.
- Google Workspace: use the values in Google's setup guide, see the Google Workspace guide.
- Microsoft 365: the correct MX value is shown in the admin center under your domain's DNS records, see the Microsoft 365 guide.
How to confirm it worked
- Run
dig MX example.com +shortagain. You should see only hostnames, never IP addresses. - Run
digon each hostname. Each one should return IP addresses directly, with no alias in front. - Wait for the old record's TTL (cache time) to pass. It is often between a few minutes and a few hours, and your DNS panel usually shows it.
- Send a test email to your domain from an outside account, such as a personal Gmail address, and from a second provider if you can. Reply to confirm two way delivery.
- Run an MX lookup tool again and check there are no errors.
If mail still goes missing after this, see emails going to spam for the next things to check.
How to stop it coming back
- Keep a note of your mail provider's exact MX hostnames and priorities, so nobody has to guess them later.
- Never paste an IP address into an MX field, and never point an MX at a name you did not create as an A record.
- Review your MX records whenever you change web host, move DNS to a new provider or switch email service. Old records are often copied over unchanged.
- If the mail hostname points to your own server, update its A record when the server's IP changes.
- Check the records again every few months, or let a recurring check do it for you.
SiteMonday finds and explains this kind of problem, but changing the records is up to you or your developer or IT person.
Questions
Can an MX record point to an IP address?
No. The MX value must be a hostname, and that hostname then needs an A or AAAA record that holds the IP address. Some DNS panels accept an IP by mistake, but mail delivery to it is unreliable.
Why can't an MX record point to a CNAME?
The email standards say the MX target must be a name with its own address records, not an alias. Some mail servers follow the alias anyway, others refuse, which is why the failure is often inconsistent.
Can I put an MX record and a CNAME on the same name?
No. A name with a CNAME cannot have any other record types, so a CNAME and an MX on the same name conflict. This matters most for the bare domain (`@`).
Will fixing this cause email downtime?
Usually only a short gap while old DNS answers expire. Sending servers normally retry for a few days, so make the change in one go and test straight afterwards.
Does Cloudflare's proxy affect MX records?
MX records themselves are never proxied. The A record for your mail hostname must be set to DNS only (grey cloud), or senders will connect to Cloudflare instead of your mail server.
How long until the fix works?
As soon as the old record's TTL has expired in the caches of sending servers. That is often within minutes to a few hours, but it depends on the TTL that was set.