I need to create a tool that will check a domains live mx records against what should be expected (we have had issues with some of our staff fiddling with them and causing all i
With [dnspython][1] module (not built-in, you must pip install it):
pip install
>>> import dns.resolver >>> domain = 'hotmail.com' >>> for x in dns.resolver.resolve(domain, 'MX'): ... print(x.to_text()) ... 5 mx3.hotmail.com. 5 mx4.hotmail.com. 5 mx1.hotmail.com. 5 mx2.hotmail.com.