← All articles

MX record for your own domain: how to set the values right

Read as Markdown

An MX record tells the internet where your email should be delivered. Here we explain the priority value, the hostnames and the mistakes that most often send mail to the wrong place.

Elisabet Argårds··2026-11-07
MX record for your own domain: how to set the values right

An MX record (mail exchanger) is a DNS record that says which mail server accepts mail for your domain. When someone sends an email to name@yourdomain.se, the sending server first looks up the MX records for yourdomain.se and then connects to the server listed there. Without the right MX record, nobody knows where your mail should go, and mail to your own domain can bounce or end up with your old provider.

This guide covers what an MX record for your own domain contains, how the priority value works, why the hostname matters more than people think, and the order in which to add the records.

What an MX record does for your own domain

When you register your own domain and want email on it, you point the domain at an email provider. That is done in the DNS zone of the domain, not in the web hosting, where you add one or more MX records. Each MX record has two parts: a priority value and the hostname of a mail server.

The MX record is independent of where your website is hosted. You can have email on your domain without a website at all, as described in our article on your own email domain without a website. It also helps to keep MX separate from SPF, DKIM and DMARC in your mind: MX controls where incoming mail is received, while SPF, DKIM and DMARC control how outgoing mail is authenticated.

Priority: the lower value wins

The first thing people misunderstand about an MX record for their own domain is the priority value. According to RFC 5321, the lowest number is the most preferred. The sending server tries the server with the lowest value first, and only moves on to the next one if it does not respond.

Consider two records:

PriorityHostnameRole
10mx1.example.seprimary server
20mx2.example.sebackup

As long as mx1 responds, all mail goes there. If both have the same priority, for example 10 and 10, senders share the traffic between them. This is called load distribution, and RFC 5321 says the sending server should randomize the order among servers with the same value. For a single person the most common setup is one MX record, or two records where the backup has a higher value.

Hostnames, not IP addresses

The value in an MX record is a hostname, never an IP address. That hostname must in turn resolve to an A record (IPv4) or AAAA record (IPv6). It must not point to a CNAME alias. If you have an alias such as mail.yourdomain.se that points to your provider's server, the MX record should instead point to the hostname that has the A or AAAA record.

This is one of the most common mistakes. An MX record that points to an alias may work for a while, but not all senders handle it the same way. Always check with a DNS lookup that the MX value resolves directly to an address.

How to add the MX records in order

The procedure is the same whichever DNS provider you use. Follow these steps in this order:

  1. Get the exact MX hostnames and priority values your email provider specifies. Use the provider's own documentation, not an old copy from a forum.
  2. Log in to whoever administers your DNS zone.
  3. Note which MX records already exist. If you are moving from another provider, the old records must be removed, otherwise mail can keep going there.
  4. Add the new MX records with the correct priority.
  5. Wait for the change to spread. How long that takes depends on the TTL value of the old records, so if you can, lower the TTL a few hours before the switch.
  6. Test by sending an email to the address and check that it arrives in the right inbox.

Common mistakes with an MX record for your own domain

Most errors are easy to avoid once you know what to check.

  • Old MX records left in place. If the old provider's record stays with a lower priority, it receives mail that should go to the new one.
  • An MX value that is an IP address. Always use a hostname.
  • An MX value that points to a CNAME. The hostname must have an A or AAAA record.
  • Confusing MX with SPF, DKIM and DMARC. A correct MX record does not mean outgoing mail is authenticated. That needs separate records, described in how to set up SPF, DKIM and DMARC for your own domain.
  • No backup. A single MX record is a single point of failure. If your provider offers a backup server, add it with a higher priority value.

Frequently asked questions about MX records for your own domain

Can I have more than one MX record? Yes. DNS allows several, and a domain can have several mail servers for redundancy or load sharing.

Must the MX value be a hostname? Yes. It should be a hostname that itself has an A or AAAA record, not an IP address or a CNAME.

Which priority value should I choose? The relative order matters more than the numbers. The lowest value wins, so 10 before 20 does the same job as 1 before 2. Follow your provider's values if they give them.

Does the MX record affect my website? No. The MX record only controls email. Your website is controlled by separate A or CNAME records for www and the apex domain.

If you are unsure, ask your provider to confirm the values they expect and check the result with a DNS tool before you switch fully. A wrong MX record is rarely noticed at once, but mail disappears quietly.

Related articles

Våra källor

Myndigheter och offentliga källor som rör ämnet:

Relaterade källor

Fördjupa dig vidare hos svenska medie- och referenskällor: