What Is an MX Record and How to Check It? A, CNAME and MX DNS Records

Sunucun 4 min read

An MX record (Mail Exchanger) is a DNS record that specifies which mail server should receive emails sent to a domain. When someone sends an email to info@yourdomain.com, the sending server first looks up the MX records of yourdomain.com and delivers the email to the server listed there. If there is no MX record, or it is wrong, emails do not reach you. An A record points a domain to an IP address, and a CNAME record points one domain name to another.

Illustration: DNS

A, CNAME and MX Records Compared

RecordWhat it doesExample
ALinks a domain name to an IPv4 address (AAAA for IPv6)yourdomain.com → 203.0.113.10
CNAMEPoints one name to another name (an alias)www.yourdomain.com → yourdomain.com
MXSpecifies the mail server that receives email, and its priorityyourdomain.com MX 10 mail.yourdomain.com
TXTText information; SPF, DKIM and DMARC for email authenticationv=spf1 ... ~all

How Does an MX Record Work? The Priority Value

Each MX record has a priority (preference) number and a mail server name. The sending server tries the server with the lowest number first; if it cannot reach it, it moves on to the next one. Example:

yourdomain.com.  MX  10  mx1.mail-provider.com.
yourdomain.com.  MX  20  mx2.mail-provider.com.

Here, emails go to mx1 first; if mx1 does not respond, they go to mx2. If several records have the same priority, the load is shared between them.

How to Look Up an MX Record

MethodCommand / step
WindowsIn Command Prompt: nslookup -type=mx yourdomain.com
macOS / LinuxIn the terminal: dig mx yourdomain.com +short or host -t mx yourdomain.com
Asking a specific DNS servernslookup -type=mx yourdomain.com 8.8.8.8 or dig @1.1.1.1 mx yourdomain.com (to see whether a change has propagated)
Online toolIn tools such as Google Admin Toolbox Dig (toolbox.googleapps.com), type the domain and choose MX

Each line of the output shows the priority and the server name. If no MX record is returned, no server has been set up to receive email for the domain.

How to Add or Change an MX Record

  1. Find out where your domain’s DNS is managed (the registrar’s panel, the hosting panel or a DNS service such as Cloudflare). The record is changed wherever the nameservers point.
  2. In cPanel: Email > Email Routing and Zone Editor > the domain > Add MX Record. For details, see our article on cPanel DNS settings.
  3. Enter the MX values and priorities given by your mail provider (for example Google Workspace, Microsoft 365 or your hosting’s own mail server) exactly; delete old MX records you no longer use.
  4. Also add SPF (TXT), DKIM and DMARC records according to the provider’s instructions; otherwise the emails you send may end up in spam.
  5. How long the change takes to propagate depends on the record’s TTL; it can take from a few minutes to a few hours. Check with the commands above during this time. If your own computer keeps showing the old record, flush your DNS cache.

Common MX Record Mistakes

  • Putting an IP address in the MX record: An MX record must point to a server name (for example mail.yourdomain.com), not an IP; that name must have its own A/AAAA record.
  • Pointing MX to a CNAME: According to DNS standards, the name an MX record points to must not be a CNAME; use a name that has an A/AAAA record directly.
  • Leaving the old provider’s MX: If old records remain when you move to a new provider, some emails go to the old server.
  • Editing the record in the wrong place: If the nameservers point to Cloudflare, changes made in the registrar’s panel have no effect.
  • Putting a CNAME on the root domain: A CNAME cannot be used for yourdomain.com (the root); it conflicts with other records at the root such as MX.

For how DNS works in general, see our articles what is DNS, creating email in cPanel and, for mail client connection problems, cannot connect to the IMAP server. To use business email with your domain, take a look at our hosting plans.

Frequently Asked Questions

Can email arrive without an MX record?

If there is no MX record, the standards allow the sending server to try delivering to the domain’s A/AAAA record, but this is not reliable and in most cases the email does not arrive. Every domain that receives email should have a correct MX record.

Can the website be in one place and email in another?

Yes. The A record points to the server where the website is, and the MX record points to the email provider; the two are independent of each other.

Should I use an A record or a CNAME?

If you know the server’s static IP address, use an A record. If a service gives you a name instead of an IP (for example a CDN or a site builder), use a CNAME for the subdomain.

Categories

Latest guides