Skip to content
Snippets Groups Projects
Commit 5013d72a authored by Florent Thiery's avatar Florent Thiery
Browse files

detect if relayless situation will have emails sent to spam, refs #20849

parent ab950bb6
No related branches found
No related tags found
No related merge requests found
...@@ -53,8 +53,15 @@ def check_relay(): ...@@ -53,8 +53,15 @@ def check_relay():
if status == 0: if status == 0:
configured_relay = out[len('relayhost'):].strip(' \t=') configured_relay = out[len('relayhost'):].strip(' \t=')
else: else:
print_red('Configured relay not found.') configured_relay = None
return False 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') conf_relay = conf.get('EMAIL_SMTP_SERVER')
if conf_relay != configured_relay: if conf_relay != configured_relay:
print_red('Configured STMP relay (%s) does not match the expected value (%s).' % (configured_relay, conf_relay)) print_red('Configured STMP relay (%s) does not match the expected value (%s).' % (configured_relay, conf_relay))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment