MX Records
An MX record routes email for your domain to a mail server. Each MX record has a priority (a
preference number) and a mail server hostname. Mail delivery tries the lowest priority number
first.
Fields
Section titled “Fields”| Field | Example | Notes |
|---|---|---|
| Name | @ | Usually the apex, so mail addresses are @your-domain. |
| Type | MX | |
| Priority | 10 | 0 to 65535. ZCP prefers lower values. Required for MX. |
| Content | mail.example.com. | The mail server hostname. End it with a trailing dot. |
| TTL | 3600 | Seconds. |
Create
Section titled “Create”Console: choose type MX, set Priority and the mail server value in their own fields.
@ MX 10 mail.example.com. 3600CLI (MX requires --priority):
zcp dns record-create --domain examplecom --name @ --type MX \ --content mail.example.com. --priority 10 --ttl 3600API (send priority as a separate field):
curl -s -X POST "https://api.zcp.zsoftly.ca/api/dns/domains/examplecom/records" \ -H "Authorization: Bearer your-token" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "name": "@", "type": "MX", "content": "mail.example.com.", "priority": 10, "ttl": 3600 }'Verify
Section titled “Verify”dig MX example.com +short# 10 mail.example.com.Multiple Mail Servers
Section titled “Multiple Mail Servers”Add several MX records with different priorities for a primary and a backup:
zcp dns record-create --domain examplecom --name @ --type MX --content mail1.example.com. --priority 10zcp dns record-create --domain examplecom --name @ --type MX --content mail2.example.com. --priority 20Mail delivers to mail1 first, then falls back to mail2 if the primary is unreachable.
- Priority is separate. Do not put the number in the value (
10 mail.example.com.). The console, CLI, and API each take priority in its own field. - The mail server needs an address. The
MXtarget must resolve to anAorAAAArecord. It cannot point at aCNAME. - A
0priority is valid and is sent correctly.
See also: TXT records for SPF and DKIM, Worked examples, Record types