What is an MX Record?
An MX (Mail Exchanger) record specifies which mail servers are responsible for accepting email for a domain. Without MX records, nobody can send email to addresses at your domain. The MX record maps your domain to the hostname of one or more mail servers, along with a priority value that controls which server email gets delivered to first.
yourdomain.com. 3600 IN MX 10 mail.yourdomain.com. yourdomain.com. 3600 IN MX 20 mail2.yourdomain.com.
Understanding MX Priority
The number in an MX record (10, 20, etc.) is the priority. Lower numbers mean higher priority. Mail servers try the lowest priority server first; if it's unavailable, they try the next highest, and so on. This provides redundancy and fallback routing.
- ▸Priority 10 → tried first (primary mail server)
- ▸Priority 20 → tried second if priority 10 fails (backup)
- ▸Equal priorities → load balanced between servers
Setting Up Google Workspace (Gmail) MX Records
yourdomain.com. MX 1 aspmx.l.google.com. yourdomain.com. MX 5 alt1.aspmx.l.google.com. yourdomain.com. MX 5 alt2.aspmx.l.google.com. yourdomain.com. MX 10 alt3.aspmx.l.google.com. yourdomain.com. MX 10 alt4.aspmx.l.google.com.
Setting Up Microsoft 365 (Outlook) MX Record
# Microsoft generates a unique MX record for your tenant: yourdomain.com. MX 0 yourdomain-com.mail.protection.outlook.com.
Setting Up ProtonMail MX Records
yourdomain.com. MX 10 mail.protonmail.ch. yourdomain.com. MX 20 mailsec.protonmail.ch.
How MX Records Work
When someone sends an email to you@yourdomain.com, here's what happens:
- ▸The sending mail server queries DNS for the MX records of
yourdomain.com - ▸DNS returns all MX records, ordered by priority
- ▸The sending server connects to the lowest-priority mail server (port 25)
- ▸If that server is unavailable, it tries the next in priority order
- ▸The mail is delivered and placed in your inbox
yourdomain.com MX 203.0.113.42 is invalid. You need a hostname like mail.yourdomain.com that itself has an A record.MX Records and CNAME Conflicts
You cannot have MX records on a hostname that also has a CNAME record. This is a fundamental DNS rule. If you need both a CNAME (e.g., for a website) and email on the same name, you must use an A record for the website instead.
Common MX Record Mistakes
- ▸Pointing MX to an IP address instead of a hostname
- ▸Forgetting to add SPF, DKIM, and DMARC TXT records for email authentication
- ▸Having a CNAME on the same hostname as MX records
- ▸Not removing old MX records when switching email providers
- ▸Using the wrong priority value (check your provider's documentation)