What causes “invalid MX record”?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

You send an email and it bounces back with something like invalid MX record or MX lookup failed. The recipient's domain exists, DNS resolves, everything looks fine on the surface. So what's actually broken?

An MX record is the DNS entry that tells your sending server where to deliver mail for a given domain. Think of it as the address label on the envelope. If that label is missing, malformed, or points to a building that doesn't exist, the mail has nowhere to go and bounces back immediately.

Here are the most common reasons an MX record comes back invalid.

The MX hostname has no A record. The MX record might say "mail.example.com" but that hostname has no corresponding A record (the DNS entry that maps a name to an IP address). Your server looks up the MX, finds the hostname, tries to resolve that hostname to an IP, and hits a dead end. This is probably the most common cause of this error.

The MX record points to a CNAME. This is a rules violation in DNS. MX records are not allowed to point to a CNAME alias. They must point directly to an A record. Some DNS providers let you create this configuration anyway, which means it looks valid in your control panel but breaks in practice.

Syntax errors in the record. A typo in the hostname, a missing or extra character, or incorrect priority formatting can all produce an invalid result. These are easy to miss when you're staring at a long DNS list.

Missing trailing dot in fully qualified domain names. In raw DNS, a fully qualified domain name like mail.harborpost.net. needs a trailing dot to signal it's absolute, not relative. Some DNS tools add this automatically. Others don't, which can cause lookup failures depending on the resolver.

An MX record with a priority but no hostname. This produces a malformed record that most mail servers reject outright.

Propagation lag after a recent change. If the MX was just updated, old DNS resolvers may still be caching the previous (broken) version. This one resolves itself once the TTL expires, but it can cause confusing bounce patterns in the meantime.

To diagnose this, run a quick MX lookup. On a Mac or Linux terminal, dig MX yourdomain.com will show you the current MX records. On Windows, nslookup -type=MX yourdomain.com does the same. Once you have the MX hostnames, check each one resolves to an IP with dig A mail.yourdomain.com (or nslookup mail.yourdomain.com). If any hostname comes back with no answer, that's your problem.

One important thing to know about this error: if it's happening on incoming mail to your domain, it's your DNS to fix. If it's a bounce you're getting when sending to someone else's domain, there's nothing you can do on your end. Their domain's DNS is broken, and only they can fix it. Your best bet is to reach them via another channel and let them know.

Now you can check your own domain's MX setup with our free email header analyzer, or if things feel broken right now, our SOS hotline is free and we'll walk through it with you.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Diagnose my MX bounce

We're getting 'invalid MX record' bounces and I want to diagnose the exact cause. Our domain is your domain. Here's what I've already checked: what you've verified so far. Can you walk through each possible cause, tell me which specific DNS commands to run, and explain what a healthy MX lookup result should look like versus a broken one? Also, is this something we can fix ourselves or is it on the recipient's side?

Edit the yellow boxes, then send to the AI of your choice.