How to check MX records with nslookup

Use nslookup to check the MX records of any domain.

Use the mx value with the -type parameter to find the MX records of a domain:

$ nslookup -type=mx my_domain_name.com

In our example below we're querying the MX records of google.com:

$ nslookup -type=mx google.com

Server: 192.168.224.1
Address: 192.168.224.1#53

Non-authoritative answer:
google.com  mail exchanger = 10 smtp.google.com.
Name: smtp.google.com
Address: 142.251.5.27
Name: smtp.google.com
Address: 142.251.5.26
Name: smtp.google.com
Address: 64.233.184.26
Name: smtp.google.com
Address: 64.233.184.27
Name: smtp.google.com
Address: 74.125.71.27
Name: smtp.google.com
Address: 2a00:1450:400c:c1b::16
Name: smtp.google.com
Address: 2a00:1450:400c:c1b::1a
Name: smtp.google.com
Address: 2a00:1450:400c:cOb::16
Name: smtp.google.com
Address: 2a00:1450:400c:cOb::1a

Authoritative answers can be found from:

nslookup mx records output example