code: def check_smtp_domain (self, mail):
          
          from dns.exception import DNSException
          log.debug(LOG_CHECK, "checking mail address %r", mail)
          mail = strformat.ascii_safe(mail)
          username, domain = mail.rsplit('@', 1)
          log.debug(LOG_CHECK, "looking up MX mailhost %r", domain)
          try:
              answers = resolver.query(domain, 'MX')
          except DNSException:
              answers = []
          if len(answers) == 0:
              self.add_warning(_("No MX mail host for %(domain)s found.") %
                              {'domain': domain},
                               tag=WARN_MAIL_NO_MX_HOST)
              try:
                  answers = resolver.query(domain, 'A')
              except DNSException:
                  answers = []
              if len(answers) == 0:
                  self.set_result(_("No host for %(domain)s found.") %
                                   {'domain': domain}, valid=False,
                                   overwrite=True)
                  return
              # set preference to zero
              mxdata = [(0, rdata.to_text(omit_final_dot=True))
                        for rdata in answers]
          else:
              from dns.rdtypes.mxbase import MXBase
              mxdata = [(rdata.preference,
                         rdata.exchange.to_text(omit_final_dot=True))
                         for rdata in answers if isinstance(rdata, MXBase)]
              if not mxdata:
                  self.set_result(
                      _("Got invalid DNS answer %(answer)s for %(domain)s.") %
                      {'answer': answers, 'domain': domain}, valid=False,
                       overwrite=True)
                  return
              # sort according to preference (lower preference means this
              # host should be preferred)
              mxdata.sort()
          # debug output
          log.debug(LOG_CHECK, "found %d MX mailhosts:", len(answers))
          for preference, host in mxdata:
              log.debug(LOG_CHECK, "MX host %r, preference %d", host, preference)
              pass
          self.set_result(_("Valid mail address syntax"))
docs: Check a single mail address.