code: def query_mxrecords(self):
          
          import dns.resolver
          logging.info('Resolving DNS query...')
          answers = dns.resolver.query(self.domain, 'MX')
          addresses = [answer.exchange.to_text() for answer in answers]
          logging.info(
              '{} records found:\n{}'.format(
                  len(addresses), '\n  '.join(addresses)))
          return addresses
docs: Looks up for the MX DNS records of the recipient SMTP server