What is an MX Record?
An MX record (Mail Exchange record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is a fundamental part of the Simple Mail Transfer Protocol (SMTP).
Structure of an MX Record
example.com. 3600 IN MX 10 aspmx.l.google.com.
- Host: The domain receiving the mail (usually the root domain).
- TTL: Time to Live.
- Type:
MX. - Priority: A numerical value (lower means higher preference).
- Value: The hostname of the mail server.
How Priority Works
You can list multiple MX records for a single domain. Each record is assigned a priority (preference) number.
- Primary Server: Assign the lowest priority number (e.g., 0 or 10) to your main mail server.
- Backup Servers: Assign higher numbers (e.g., 20, 30, 40) to secondary or backup mail servers.
- Equal Priority: If multiple servers have the same priority, the sending server will pick one at random, effectively load balancing the incoming mail.
Important Restriction: Points to Hostname Only
An MX record must point to a hostname (a domain name), never directly to an IP address. That hostname must have its own A or AAAA record defined elsewhere.
Typical Setup: Google Workspace
A typical configuration for a domain using Google Workspace for email would look like this:
Priority: 1 Value: aspmx.l.google.com.
Priority: 5 Value: alt1.aspmx.l.google.com.
Priority: 5 Value: alt2.aspmx.l.google.com.
Priority: 10 Value: alt3.aspmx.l.google.com.
Priority: 10 Value: alt4.aspmx.l.google.com.
Email Security & MX Records
While MX records handle *receiving* mail, you should also configure SPF, DKIM, and DMARC (all via TXT records) to secure the *sending* of mail and prevent spoofing.