1 2 3 4 5 6 7
#!/usr/bin/env python import dns.resolver answers = dns.resolver.query('nominum.com', 'MX') for rdata in answers: print 'Host', rdata.exchange, 'has preference', rdata.preference