How MX Records Route Your Email
MX (Mail Exchanger) records are DNS records that specify which mail servers are responsible for receiving email on behalf of your domain. When someone sends an email to user@example.com, the sending mail server looks up the MX records for example.com to determine where to deliver the message.
How MX Records Work
Each MX record contains two key pieces of information:
- Priority (Preference): A numeric value that determines the order in which mail servers are tried. Lower numbers have higher priority.
- Mail Server (Value): The hostname of the mail server that will accept email for the domain.
Example MX record setup:
example.com. 3600 IN MX 10 mail.example.com.
example.com. 3600 IN MX 20 backup-mail.example.com.
In this example, mail is first directed to mail.example.com (priority 10). If that server is unavailable, the sending server will try backup-mail.example.com (priority 20).
Viewing and Editing MX Records in DirectAdmin
- Log in to DirectAdmin and go to Account Manager → DNS Management.
- Look for existing MX records in the list.
- To modify an MX record, click on it, update the priority or mail server value, and click Save.
- To add a new MX record, select MX as the record type, enter the priority and the mail server hostname, then click Add.
Common MX Configurations
- Local mail (server-hosted): MX points to
mail.example.comwhich resolves to your server's IP. - Google Workspace:
Priority 1: ASPMX.L.GOOGLE.COM Priority 5: ALT1.ASPMX.L.GOOGLE.COM Priority 5: ALT2.ASPMX.L.GOOGLE.COM Priority 10: ALT3.ASPMX.L.GOOGLE.COM Priority 10: ALT4.ASPMX.L.GOOGLE.COM - Microsoft 365: MX points to
example-com.mail.protection.outlook.com(the exact value is provided in your Microsoft 365 admin panel).
Testing MX Records
Use online tools such as MXToolbox to verify your MX records are resolving correctly. You can also use the command line:
dig MX example.com
nslookup -type=MX example.com