summary refs log tree commit diff
path: root/synapse/push/mailer.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-07-14 10:00:53 +0100
committerGitHub <noreply@github.com>2020-07-14 10:00:53 +0100
commitf886a699169e416dca7a8d23d3874dfada24629d (patch)
treeeaa3d9eabe749f2ae50bcd7a9b3170421be220cd /synapse/push/mailer.py
parentSupport handling registration requests across multiple client readers. (#7830) (diff)
downloadsynapse-f886a699169e416dca7a8d23d3874dfada24629d.tar.xz
Correctly pass app_name to all email templates. (#7829)
We didn't do this for e.g. registration emails.
Diffstat (limited to 'synapse/push/mailer.py')
-rw-r--r--synapse/push/mailer.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/push/mailer.py b/synapse/push/mailer.py
index dda560b2c2..a10dba0af6 100644
--- a/synapse/push/mailer.py
+++ b/synapse/push/mailer.py
@@ -269,7 +269,6 @@ class Mailer(object):
                 user_id, app_id, email_address
             ),
             "summary_text": summary_text,
-            "app_name": self.app_name,
             "rooms": rooms,
             "reason": reason,
         }
@@ -278,7 +277,7 @@ class Mailer(object):
             email_address, "[%s] %s" % (self.app_name, summary_text), template_vars
         )
 
-    async def send_email(self, email_address, subject, template_vars):
+    async def send_email(self, email_address, subject, extra_template_vars):
         """Send an email with the given information and template text"""
         try:
             from_string = self.hs.config.email_notif_from % {"app": self.app_name}
@@ -291,6 +290,13 @@ class Mailer(object):
         if raw_to == "":
             raise RuntimeError("Invalid 'to' address")
 
+        template_vars = {
+            "app_name": self.app_name,
+            "server_name": self.hs.config.server.server_name,
+        }
+
+        template_vars.update(extra_template_vars)
+
         html_text = self.template_html.render(**template_vars)
         html_part = MIMEText(html_text, "html", "utf8")