prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Cannot send email after upgrade to 1.9 `non DNSSEC destination`
  ## Before you open your issue
  - [x] Check if no issue or pull-request for this already exists.
  - [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)
  - [x] You understand `Mailu` is made by volunteers in their **free time** — be conscise, civil and accept that delays can occur.
  - [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.
  
  ## Environment & Versions
  ### Environment
   - [x] docker-compose
   - [ ] kubernetes
   - [ ] docker swarm
  
  ### Versions
  1.9
  
  ## Description
  Thanks for all the work! 1.9 seems like an amazing release overall ❤️ 
  
  I upgraded to 1.9, generated the new docker-compose file with the tool.
  Copied the relevant env variables over and started everything.
  I can still receive mails, and send internal one (from and to my own domain)
  I cannot send mails to external providers.
  
  after restoring from backup everything works in 1.8
  
  ```
  Final-Recipient: rfc822; ******
  Original-Recipient: rfc822;******
  Action: delayed
  Status: 4.7.5
  Diagnostic-Code: X-Postfix; non DNSSEC destination
  Will-Retry-Until: Fri,  7 Jan 2022 18:38:34 +0000 (UTC)
  Return-Path: <*****>
  From: Cloud <*******>
  DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nicco.io; s=dkim;
  	t=1641148715;
  	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
  	 to:to:cc:mime-version:mime-version:content-type:content-type:
  	 in-reply-to:in-reply-to:references:references;
  	bh=Q0j3Ph9l8nLeBMIzdq6aOtNcsZOyiD8WuiQSGgc2oeY=;
  	b=nF+9OZeRSSEDZ995inbj/6nDYgbTDMhPGc63Gab3FN1A984PxY7rDoHIhkO5nvh2wzNZG6
  	5jIAmfCyYfHriJawNrtcKeUA4wBO5YgYPWag6CbGmWQ8sGSIty2fjIO0W4dWfWy+OjsksX
  	sJ2TK8uft8Ax9F9QmQKMuZHBP3Myh/I=
  Content-Type: multipart/mixed;
  	boundary="Apple-Mail=_DD0DBE9A-59E8-455E-B4DD-1317DF1D24F9"
  Mime-Version: 1.0
  Subject: =*****
  Date: Sun, 2 Jan 2022 19:38:33 +0100
  References: <****>
  <****>
  <****>
  <****>
  To: ***
  In-Reply-To: ****
  Message-Id: ****
  X-Spam-Level: *
  X-Spamd-Bar: +
  Authentication-Results: *****;
  	auth=pass smtp.mailfrom=*****
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `core/admin/start.py`
  Content:
  ```
  1 #!/usr/bin/python3
  2 
  3 import os
  4 import logging as log
  5 import sys
  6 
  7 log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "INFO"))
  8 
  9 os.system("flask mailu advertise")
  10 os.system("flask db upgrade")
  11 
  12 account = os.environ.get("INITIAL_ADMIN_ACCOUNT")
  13 domain = os.environ.get("INITIAL_ADMIN_DOMAIN")
  14 password = os.environ.get("INITIAL_ADMIN_PW")
  15 
  16 if account is not None and domain is not None and password is not None:
  17     mode = os.environ.get("INITIAL_ADMIN_MODE", default="ifmissing")
  18     log.info("Creating initial admin accout %s@%s with mode %s",account,domain,mode)
  19     os.system("flask mailu admin %s %s '%s' --mode %s" % (account, domain, password, mode))
  20 
  21 start_command="".join([
  22     "gunicorn --threads ", str(os.cpu_count()),
  23     " -b :80 ",
  24     "--access-logfile - " if (log.root.level<=log.INFO) else "",
  25     "--error-logfile - ",
  26     "--preload ",
  27     "'mailu:create_app()'"])
  28 
  29 os.system(start_command)
  30
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/core/admin/start.py b/core/admin/start.py
  --- a/core/admin/start.py
  +++ b/core/admin/start.py
  @@ -18,6 +18,34 @@
       log.info("Creating initial admin accout %s@%s with mode %s",account,domain,mode)
       os.system("flask mailu admin %s %s '%s' --mode %s" % (account, domain, password, mode))
   
  +def test_DNS():
  +    import dns.resolver
  +    import dns.exception
  +    import dns.flags
  +    import dns.rdtypes
  +    import dns.rdatatype
  +    import dns.rdataclass
  +    import time
  +    # DNS stub configured to do DNSSEC enabled queries
  +    resolver = dns.resolver.Resolver()
  +    resolver.use_edns(0, 0, 1232)
  +    resolver.flags = dns.flags.AD | dns.flags.RD
  +    nameservers = resolver.nameservers
  +    for ns in nameservers:
  +        resolver.nameservers=[ns]
  +        while True:
  +            try:
  +                result = resolver.query('example.org', dns.rdatatype.A, dns.rdataclass.IN, lifetime=10)
  +            except Exception as e:
  +                log.critical("Your DNS resolver at %s is not working (%s). Please use another resolver or enable unbound via https://setup.mailu.io.", ns, e);
  +            else:
  +                if result.response.flags & dns.flags.AD:
  +                    break
  +                log.critical("Your DNS resolver at %s isn't doing DNSSEC validation; Please use another resolver or enable unbound via https://setup.mailu.io.", ns)
  +            time.sleep(5)
  +
  +test_DNS()
  +
   start_command="".join([
       "gunicorn --threads ", str(os.cpu_count()),
       " -b :80 ",
  
verification_info: {"golden_diff": "diff --git a/core/admin/start.py b/core/admin/start.py\n--- a/core/admin/start.py\n+++ b/core/admin/start.py\n@@ -18,6 +18,34 @@\n     log.info(\"Creating initial admin accout %s@%s with mode %s\",account,domain,mode)\n     os.system(\"flask mailu admin %s %s '%s' --mode %s\" % (account, domain, password, mode))\n \n+def test_DNS():\n+    import dns.resolver\n+    import dns.exception\n+    import dns.flags\n+    import dns.rdtypes\n+    import dns.rdatatype\n+    import dns.rdataclass\n+    import time\n+    # DNS stub configured to do DNSSEC enabled queries\n+    resolver = dns.resolver.Resolver()\n+    resolver.use_edns(0, 0, 1232)\n+    resolver.flags = dns.flags.AD | dns.flags.RD\n+    nameservers = resolver.nameservers\n+    for ns in nameservers:\n+        resolver.nameservers=[ns]\n+        while True:\n+            try:\n+                result = resolver.query('example.org', dns.rdatatype.A, dns.rdataclass.IN, lifetime=10)\n+            except Exception as e:\n+                log.critical(\"Your DNS resolver at %s is not working (%s). Please use another resolver or enable unbound via https://setup.mailu.io.\", ns, e);\n+            else:\n+                if result.response.flags & dns.flags.AD:\n+                    break\n+                log.critical(\"Your DNS resolver at %s isn't doing DNSSEC validation; Please use another resolver or enable unbound via https://setup.mailu.io.\", ns)\n+            time.sleep(5)\n+\n+test_DNS()\n+\n start_command=\"\".join([\n     \"gunicorn --threads \", str(os.cpu_count()),\n     \" -b :80 \",\n", "issue": "Cannot send email after upgrade to 1.9 `non DNSSEC destination`\n## Before you open your issue\r\n- [x] Check if no issue or pull-request for this already exists.\r\n- [x] Check [documentation](https://mailu.io/master/) and [FAQ](https://mailu.io/master/faq.html). (Tip, use the search function on the documentation page)\r\n- [x] You understand `Mailu` is made by volunteers in their **free time** \u2014 be conscise, civil and accept that delays can occur.\r\n- [x] The title of the issue should be short and simple. It should contain specific terms related to the actual issue. Be specific while writing the title.\r\n\r\n## Environment & Versions\r\n### Environment\r\n - [x] docker-compose\r\n - [ ] kubernetes\r\n - [ ] docker swarm\r\n\r\n### Versions\r\n1.9\r\n\r\n## Description\r\nThanks for all the work! 1.9 seems like an amazing release overall \u2764\ufe0f \r\n\r\nI upgraded to 1.9, generated the new docker-compose file with the tool.\r\nCopied the relevant env variables over and started everything.\r\nI can still receive mails, and send internal one (from and to my own domain)\r\nI cannot send mails to external providers.\r\n\r\nafter restoring from backup everything works in 1.8\r\n\r\n```\r\nFinal-Recipient: rfc822; ******\r\nOriginal-Recipient: rfc822;******\r\nAction: delayed\r\nStatus: 4.7.5\r\nDiagnostic-Code: X-Postfix; non DNSSEC destination\r\nWill-Retry-Until: Fri,  7 Jan 2022 18:38:34 +0000 (UTC)\r\nReturn-Path: <*****>\r\nFrom: Cloud <*******>\r\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nicco.io; s=dkim;\r\n\tt=1641148715;\r\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\r\n\t to:to:cc:mime-version:mime-version:content-type:content-type:\r\n\t in-reply-to:in-reply-to:references:references;\r\n\tbh=Q0j3Ph9l8nLeBMIzdq6aOtNcsZOyiD8WuiQSGgc2oeY=;\r\n\tb=nF+9OZeRSSEDZ995inbj/6nDYgbTDMhPGc63Gab3FN1A984PxY7rDoHIhkO5nvh2wzNZG6\r\n\t5jIAmfCyYfHriJawNrtcKeUA4wBO5YgYPWag6CbGmWQ8sGSIty2fjIO0W4dWfWy+OjsksX\r\n\tsJ2TK8uft8Ax9F9QmQKMuZHBP3Myh/I=\r\nContent-Type: multipart/mixed;\r\n\tboundary=\"Apple-Mail=_DD0DBE9A-59E8-455E-B4DD-1317DF1D24F9\"\r\nMime-Version: 1.0\r\nSubject: =*****\r\nDate: Sun, 2 Jan 2022 19:38:33 +0100\r\nReferences: <****>\r\n<****>\r\n<****>\r\n<****>\r\nTo: ***\r\nIn-Reply-To: ****\r\nMessage-Id: ****\r\nX-Spam-Level: *\r\nX-Spamd-Bar: +\r\nAuthentication-Results: *****;\r\n\tauth=pass smtp.mailfrom=*****\r\n```\n", "before_files": [{"content": "#!/usr/bin/python3\n\nimport os\nimport logging as log\nimport sys\n\nlog.basicConfig(stream=sys.stderr, level=os.environ.get(\"LOG_LEVEL\", \"INFO\"))\n\nos.system(\"flask mailu advertise\")\nos.system(\"flask db upgrade\")\n\naccount = os.environ.get(\"INITIAL_ADMIN_ACCOUNT\")\ndomain = os.environ.get(\"INITIAL_ADMIN_DOMAIN\")\npassword = os.environ.get(\"INITIAL_ADMIN_PW\")\n\nif account is not None and domain is not None and password is not None:\n    mode = os.environ.get(\"INITIAL_ADMIN_MODE\", default=\"ifmissing\")\n    log.info(\"Creating initial admin accout %s@%s with mode %s\",account,domain,mode)\n    os.system(\"flask mailu admin %s %s '%s' --mode %s\" % (account, domain, password, mode))\n\nstart_command=\"\".join([\n    \"gunicorn --threads \", str(os.cpu_count()),\n    \" -b :80 \",\n    \"--access-logfile - \" if (log.root.level<=log.INFO) else \"\",\n    \"--error-logfile - \",\n    \"--preload \",\n    \"'mailu:create_app()'\"])\n\nos.system(start_command)\n", "path": "core/admin/start.py"}], "after_files": [{"content": "#!/usr/bin/python3\n\nimport os\nimport logging as log\nimport sys\n\nlog.basicConfig(stream=sys.stderr, level=os.environ.get(\"LOG_LEVEL\", \"INFO\"))\n\nos.system(\"flask mailu advertise\")\nos.system(\"flask db upgrade\")\n\naccount = os.environ.get(\"INITIAL_ADMIN_ACCOUNT\")\ndomain = os.environ.get(\"INITIAL_ADMIN_DOMAIN\")\npassword = os.environ.get(\"INITIAL_ADMIN_PW\")\n\nif account is not None and domain is not None and password is not None:\n    mode = os.environ.get(\"INITIAL_ADMIN_MODE\", default=\"ifmissing\")\n    log.info(\"Creating initial admin accout %s@%s with mode %s\",account,domain,mode)\n    os.system(\"flask mailu admin %s %s '%s' --mode %s\" % (account, domain, password, mode))\n\ndef test_DNS():\n    import dns.resolver\n    import dns.exception\n    import dns.flags\n    import dns.rdtypes\n    import dns.rdatatype\n    import dns.rdataclass\n    import time\n    # DNS stub configured to do DNSSEC enabled queries\n    resolver = dns.resolver.Resolver()\n    resolver.use_edns(0, 0, 1232)\n    resolver.flags = dns.flags.AD | dns.flags.RD\n    nameservers = resolver.nameservers\n    for ns in nameservers:\n        resolver.nameservers=[ns]\n        while True:\n            try:\n                result = resolver.query('example.org', dns.rdatatype.A, dns.rdataclass.IN, lifetime=10)\n            except Exception as e:\n                log.critical(\"Your DNS resolver at %s is not working (%s). Please use another resolver or enable unbound via https://setup.mailu.io.\", ns, e);\n            else:\n                if result.response.flags & dns.flags.AD:\n                    break\n                log.critical(\"Your DNS resolver at %s isn't doing DNSSEC validation; Please use another resolver or enable unbound via https://setup.mailu.io.\", ns)\n            time.sleep(5)\n\ntest_DNS()\n\nstart_command=\"\".join([\n    \"gunicorn --threads \", str(os.cpu_count()),\n    \" -b :80 \",\n    \"--access-logfile - \" if (log.root.level<=log.INFO) else \"\",\n    \"--error-logfile - \",\n    \"--preload \",\n    \"'mailu:create_app()'\"])\n\nos.system(start_command)\n", "path": "core/admin/start.py"}]}