How to Determine the Email Server (MX Records) for a Domain
When sending emails, your email client communicates with a specific email server to deliver messages to recipients. To find the correct email server for a particular domain (e.g., example.com
), you'll need to identify its Mail Exchange (MX) records. MX records are part of the Domain Name System (DNS) and designate the servers responsible for handling email for a domain.
This guide will walk you through the process step-by-step.
Step 1: Understand the Basics
- What are MX records? Mail Exchange (MX) records are DNS entries that specify the mail server(s) responsible for receiving emails on behalf of a domain. If there are multiple MX records, they also include a "priority" value to determine the order in which servers should be used.
- Why do you need to find MX records? Knowing the MX records helps you identify the email service provider for a domain or diagnose email delivery issues.
Step 2: Tools to Retrieve MX Records
To find MX records, you can use DNS query tools. Common options include:
- Command-line utilities (e.g.,
nslookup
,dig
) - Online DNS lookup tools
- Custom scripts or software applications
Step 3: Use the Method of Your Choice
Method 1: Using Command-line Tools
Here are instructions for different operating systems:
On Windows (using nslookup
):
Open the Command Prompt by typing cmd
in the Start menu search bar. And enter the following command:
nslookup -query=mx example.com
Replace example.com
with the domain you want to check.
Review the output for a list of MX records, which typically include:
- Server names or IP addresses
- Priority values
On Linux/macOS (using dig
):
Open your terminal and run the command:
dig example.com MX
Similar to nslookup
, the result will display the domain's MX records.
Example Output:
For the domain example.com
, you may see output like this:
example.com. 3600 IN MX 10 mail1.example.com.
example.com. 3600 IN MX 20 mail2.example.com.
Here:
10
and20
are priority values. A lower value indicates higher priority.mail1.example.com
andmail2.example.com
are the mail servers.
Method 2: Using Online MX Lookup Tools
If you're not comfortable using the command line, there are plenty of free online tools to perform an MX lookup. Popular options include:
Here's how to do it with MXToolbox:
- Open MXToolbox in your browser.
- Enter the domain name into the search bar and select "MX Lookup."
- Click the search button to see the domain's MX records.
Step 4: Understand the Results
After retrieving the MX records, evaluate the information:
- Priority: MX records with a lower priority value should be used first when delivering emails.
- Server names: These often indicate the email service provider. For example:
aspmx.l.google.com
suggests the domain uses Google Workspace (formerly G Suite).mail.protection.outlook.com
suggests the domain uses Microsoft 365.
Step 5: Optional Diagnostics
If you're troubleshooting an email issue, you might also want to:
- Ping the mail server: Verify the server is reachable.
- Perform an SMTP test: Use an SMTP (Simple Mail Transfer Protocol) testing tool to ensure email delivery works as expected.
To perform a basic SMTP test using the command line open a terminal and run the following command:
telnet mail1.example.com 25
Replace mail1.example.com
with the mail server name. If the connection is successful, you'll see a welcome message from the mail server.
Note: Port 25 is commonly used for SMTP, but some servers might prefer others, such as port 587 or 465 for secure communication.
Step 6: Document and Verify
- Record the retrieved MX records for future reference or troubleshooting.
- Cross-check results from different tools (command line, online tools) to ensure accuracy.
Summary
To determine the correct email server for a domain:
- Use DNS lookup utilities (e.g.,
nslookup
,dig
) or online tools (e.g., MXToolbox). - Review and interpret the retrieved MX records.
- Confirm server functionality if needed by performing additional tests.
By following these steps, you can easily find and understand the email infrastructure for any given domain, aiding both end-users and IT professionals alike.
Featured Merch

Latest Posts
- Wiki Story: Turn Wikipedia Articles into Captivating Narratives
- How to Determine the SMTP and IMAP Servers for a Domain
- How to Set max_input_vars in PHP: A Quick Guide for Developers
- Introducing Charla: A Terminal-Based Chat Client for Language Models
Featured Book

Subscribe to RSS Feed
This post was written by Ramiro Gómez (@yaph) and published on . Subscribe to the Geeksta RSS feed to be informed about new posts.
Disclosure: External links on this website may contain affiliate IDs, which means that I earn a commission if you make a purchase using these links. This allows me to offer hopefully valuable content for free while keeping this website sustainable. For more information, please see the disclosure section on the about page.