diff --git a/tests/test_email.py b/tests/test_email.py
index a7b400891abfa58551b154e35436c6d7555b2196..05f9bbf225e16b2920ed542d9aa3f528674c3ef9 100755
--- a/tests/test_email.py
+++ b/tests/test_email.py
@@ -68,7 +68,7 @@ def check_relay():
     print('Checking if SMTP relay conforms to conf.')
     status, out = subprocess.getstatusoutput('grep relayhost /etc/postfix/main.cf')
     if status == 0:
-        configured_relay = out[len('relayhost'):].strip(' \t=[]')
+        configured_relay = out[len('relayhost'):].strip().replace('[', '').replace(']', '')
     else:
         configured_relay = ''
     if not configured_relay:
@@ -89,7 +89,7 @@ def check_relay():
         if result != 'pass':
             print_red('ip %s is not in ubicast.eu SPF and emails sent from support@ubicast.eu may be treated as spam' % ip)
             return 3
-    conf_relay = conf.get('EMAIL_SMTP_SERVER', '').strip('[]')
+    conf_relay = conf.get('EMAIL_SMTP_SERVER', '').replace('[', '').replace(']', '')
     if conf_relay != configured_relay:
         print_red('Configured STMP relay (%s) does not match the expected value (%s).' % (configured_relay, conf_relay))
         return 3