How to Lookup the MX record(s) for a Domain

It’s important to know where mail goes for a domain, especially if you’re a system administrator looking after mail servers.
There are a whole host of web sites you can use to find MX records now – MX Records are the DNS entry so servers know where to send e-mail, destined to that domain. The way I show below is how to do it on your local machine, which returns the result from your DNS server(s). If you do this from your mail server, you’ll also be able to see, where at this moment in time, that server will send any outgoing e-mail to a domain, which can be quite useful.

Windows (nslookup

You can use nslookup in Windows to query DNS zones.  To lookup the MX records for a domain, open a command prompt:

C:\> nslookup
Default Server:  xxxxxxxxxx
> set type=mx
Non-authoritive answer:      MX   preference = 10, mail exchanger =      MX   preference = 20, mail exchanger =

OSX / Linux / BSD (host):

I’ll explain how to use host in OSX and on Linux/BSD. Anyway, host is installed by default on OSX, but probably not on Linux or BSD – you may have to install it manually. (On Ubuntu and Debian, you can install it by using ‘apt-get install host‘ if it’s not already installed).

From a terminal:

$ host -t MX mail is handled by 10 mail is handled by 20

MX records are always an FQDN (Fully Qualified Domain Name, if setup properly) and have priority levels which are the 10 and 20 you see.  Priorities are important; if a mail server tries to send an e-mail to anything@thedomain, then it’ll use the LOWEST priority mail server first. If this accepts the mail, then job complete.. if it times out or the lookup of the IP address doesn’t complete, then it’ll try the next lowest priority mail server. You can also use two mail servers with the same priority level, and mail servers will just choose one when sending – useful for a bit of simple load balancing.