From 5013d72a8fdcadd1eae7e22d9b39dfbca6643d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu> Date: Thu, 16 Mar 2017 16:24:51 +0100 Subject: [PATCH] detect if relayless situation will have emails sent to spam, refs #20849 --- tests/test_email.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_email.py b/tests/test_email.py index 50a30432..811f07bb 100755 --- a/tests/test_email.py +++ b/tests/test_email.py @@ -53,8 +53,15 @@ def check_relay(): if status == 0: configured_relay = out[len('relayhost'):].strip(' \t=') else: - print_red('Configured relay not found.') - return False + configured_relay = None + if not configured_relay: + # no relay configured, check relayless situations + domain = conf.get('MS_SERVER_NAME').split('.')[-2:] + with open('/etc/mailname', 'r') as f: + d = f.read() + if domain != 'ubicast.tv' and domain not in d: + print_red('/etc/mailname does not contain the server domain, emails will probably be treated as spam') + return False conf_relay = conf.get('EMAIL_SMTP_SERVER') if conf_relay != configured_relay: print_red('Configured STMP relay (%s) does not match the expected value (%s).' % (configured_relay, conf_relay)) -- GitLab