diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-09-20 15:21:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 15:21:30 +0100 |
commit | df3401a71d78088da36a03c73d35bc116c712df6 (patch) | |
tree | 1adb9c2f50e75a39db53e27178e2705a39a430b4 /synapse/push/mailer.py | |
parent | Remove trailing slash ability from password reset's submit_token endpoint (#6... (diff) | |
download | synapse-df3401a71d78088da36a03c73d35bc116c712df6.tar.xz |
Allow HS to send emails when adding an email to the HS (#6042)
Diffstat (limited to 'synapse/push/mailer.py')
-rw-r--r-- | synapse/push/mailer.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/synapse/push/mailer.py b/synapse/push/mailer.py index 2437235dc4..5a4fc78b4c 100644 --- a/synapse/push/mailer.py +++ b/synapse/push/mailer.py @@ -180,6 +180,35 @@ class Mailer(object): ) @defer.inlineCallbacks + def send_add_threepid_mail(self, email_address, token, client_secret, sid): + """Send an email with a validation link to a user for adding a 3pid to their account + + Args: + email_address (str): Email address we're sending the validation link to + + token (str): Unique token generated by the server to verify the email was received + + client_secret (str): Unique token generated by the client to group together + multiple email sending attempts + + sid (str): The generated session ID + """ + params = {"token": token, "client_secret": client_secret, "sid": sid} + link = ( + self.hs.config.public_baseurl + + "_matrix/client/unstable/add_threepid/email/submit_token?%s" + % urllib.parse.urlencode(params) + ) + + template_vars = {"link": link} + + yield self.send_email( + email_address, + "[%s] Validate Your Email" % self.hs.config.server_name, + template_vars, + ) + + @defer.inlineCallbacks def send_notification_mail( self, app_id, user_id, email_address, push_actions, reason ): |