summary refs log tree commit diff
path: root/synapse/config/emailconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/config/emailconfig.py')
-rw-r--r--synapse/config/emailconfig.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/config/emailconfig.py b/synapse/config/emailconfig.py
index 68fb4d8060..893034e2ef 100644
--- a/synapse/config/emailconfig.py
+++ b/synapse/config/emailconfig.py
@@ -25,17 +25,19 @@ class EmailConfig(Config):
     """
 
     def read_config(self, config):
+        self.email_enable_notifs = False
+
         email_config = config.get("email", None)
         if email_config:
             self.email_enable_notifs = email_config.get("enable_notifs", True)
 
+        if self.email_enable_notifs:
             required = [
                 "smtp_host",
                 "smtp_port",
                 "notif_from",
                 "template_dir",
                 "notif_template_html",
-
             ]
 
             missing = []
@@ -49,6 +51,11 @@ class EmailConfig(Config):
                     (", ".join(["email."+k for k in missing]),)
                 )
 
+            if config.get("public_baseurl") is None:
+                raise RuntimeError(
+                    "email.enable_notifs is True but no public_baseurl is set"
+                )
+
             self.email_smtp_host = email_config["smtp_host"]
             self.email_smtp_port = email_config["smtp_port"]
             self.email_notif_from = email_config["notif_from"]