diff --git a/tests/test_email.py b/tests/test_email.py
index 12a6534ed4c165e42ba79f838a11d9a9b32afbd6..d9e3f288dbc36b23d308999a01826ca57ff4f35c 100755
--- a/tests/test_email.py
+++ b/tests/test_email.py
@@ -80,10 +80,14 @@ def check_relay(conf: dict) -> int:
             u.warning("Cannot determine public IP address")
             return 3
         # check domain origin
-        with open("/etc/mailname", "r") as mailname:
-            data = mailname.read().strip()
-        if data not in ("ubicast.tv", "ubicast.eu"):
-            u.warning("/etc/mailname does not contain ubicast.eu or ubicast.tv")
+        if os.path.exists("/etc/mailname"):
+            with open("/etc/mailname", "r") as mailname:
+                myorigin = mailname.read().strip()
+        else:
+            out = subprocess.getoutput("grep myorigin /etc/postfix/main.cf")
+            myorigin = out.replace("myorigin", "").strip()
+        if myorigin not in ("ubicast.tv", "ubicast.eu"):
+            u.warning("The \"myorigin\" setting does not contain ubicast.eu or ubicast.tv")
             return 3
         # check spf
         result, _ = spf.check2(i=ip_addr, s="support@ubicast.eu", h="")
@@ -128,7 +132,7 @@ def check_send_test_email(conf: dict) -> int:
     else:
         u.info("Sender address is not set")
     cmd = "echo 'test email' | mail -s 'Email used to test configuration.' {}{}".format(sender, email)
-    subprocess.getstatusoutput(cmd)
+    subprocess.getoutput(cmd)
 
     # init vars
     timeout = 120