summary refs log tree commit diff
path: root/synapse/push/mailer.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add the List-Unsubscribe header for notification emails. (#16274)Patrick Cloke2023-09-111-5/+28
| | | | | | | | Adds both the List-Unsubscribe (RFC2369) and List-Unsubscribe-Post (RFC8058) headers to push notification emails, which together should: * Show an "Unsubscribe" link in the MUA UI when viewing Synapse notification emails. * Enable "one-click" unsubscribe (the user never leaves their MUA, which automatically makes a POST request to the specified endpoint).
* `N + 3`: Read from column `full_user_id` rather than `user_id` of tables ↵Shay2023-06-021-1/+1
| | | | `profiles` and `user_filters` (#15649)
* Fix missing app variable in mail subject for password resets (#15352)Cyberes2023-03-301-1/+1
| | | | | | | | | | | | | * Update mailer.py Fix `KeyError: 'app'` * Create 15352.bugfix Signed-off-by: Cyberes <cyberes@evulid.cc> --------- Signed-off-by: Cyberes <cyberes@evulid.cc>
* Move `StateFilter` to `synapse.types` (#14668)David Robertson2022-12-121-1/+1
| | | | | * Move `StateFilter` to `synapse.types` * Changelog
* Move the "email unsubscribe" resource, refactor the macaroon generator & ↵Quentin Gliech2022-06-141-3/+4
| | | | | | | | | | | | | | | | | | | | | simplify the access token verification logic. (#12986) This simplifies the access token verification logic by removing the `rights` parameter which was only ever used for the unsubscribe link in email notifications. The latter has been moved under the `/_synapse` namespace, since it is not a standard API. This also makes the email verification link more secure, by embedding the app_id and pushkey in the macaroon and verifying it. This prevents the user from tampering the query parameters of that unsubscribe link. Macaroon generation is refactored: - Centralised all macaroon generation and verification logic to the `MacaroonGenerator` - Moved to `synapse.utils` - Changed the constructor to require only a `Clock`, hostname, and a secret key (instead of a full `Homeserver`). - Added tests for all methods.
* Wait for lazy join to complete when getting current state (#12872)Erik Johnston2022-06-011-1/+3
|
* Rename storage classes (#12913)Erik Johnston2022-05-311-6/+8
|
* Fix up `state_store` naming (#12871)Erik Johnston2022-05-251-3/+3
|
* Un-revert Jinja2 fix (#12313)Brendan Abolivier2022-03-281-4/+5
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Revert "Replace instances of deprecated `Jinja2.Markup` with ↵Andrew Morgan2022-03-241-5/+4
| | | | | `markupsafe.Markup`" (#12296) This reverts commit 8810c93e828a9ed1dcb008d08be8aa9fcb4d28c3.
* Replace instances of deprecated `Jinja2.Markup` with `markupsafe.Markup` ↵Andrew Morgan2022-03-241-4/+5
| | | | | (#12289) Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-1/+1
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Improvements to bundling aggregations. (#11815)Patrick Cloke2022-01-261-1/+1
| | | | | | | | | | | This is some odds and ends found during the review of #11791 and while continuing to work in this code: * Return attrs classes instead of dictionaries from some methods to improve type safety. * Call `get_bundled_aggregations` fewer times. * Adds a missing assertion in the tests. * Do not return empty bundled aggregations for an event (preferring to not include the bundle at all, as the docstring states).
* Fix missing app variable in mail subject (#11745)David Robertson2022-01-131-2/+2
| | | | | documentation claims that you can use the %(app)s variable in password_reset and email_validation subjects, but if you do you end up with an error 500 Co-authored-by: br4nnigan <10244835+br4nnigan@users.noreply.github.com>
* Add type hints to event_push_actions. (#11594)Patrick Cloke2021-12-211-21/+19
|
* Improved push typing (#11409)Marcus2021-11-301-30/+42
| | | Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Relax `ignore-missing-imports` for modules that have stubs now and update ↵David Robertson2021-10-081-1/+1
| | | | | | | | | | | | mypy (#11006) Updating mypy past version 0.9 means that third-party stubs are no-longer distributed with typeshed. See http://mypy-lang.blogspot.com/2021/06/mypy-0900-released.html for details. We therefore pull in stub packages in setup.py Additionally, some modules that we were previously ignoring import failures for now have stubs. So let's use them. The rest of this change consists of fixups to make the newer mypy + stubs pass CI. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Use direct references for some configuration variables (part 2) (#10812)Patrick Cloke2021-09-151-5/+5
|
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-7/+7
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Correctly include room avatars in email notifications (#10658)David Robertson2021-09-011-1/+23
| | | | | | | | Judging by the template, this was intended ages ago, but we never actually passed an avatar URL to the template. So let's provide one. Closes #1546. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Update the notification email subject when invited to a space. (#10426)Patrick Cloke2021-07-211-1/+17
|
* Use inline type hints in various other places (in `synapse/`) (#10380)Jonathan de Jong2021-07-151-6/+6
|
* Split multiplart email sending into a dedicated handler (#9977)Brendan Abolivier2021-05-171-45/+8
| | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Import HomeServer from the proper module. (#9665)Patrick Cloke2021-03-231-1/+1
|
* Handle empty rooms when generating email notifications. (#9257)Patrick Cloke2021-02-041-37/+176
| | | | | | Fixes some exceptions if the room state isn't quite as expected. If the expected state events aren't found, try to find them in the historical room state. If they still aren't found, fallback to a reasonable, although ugly, value.
* Refactor email summary generation. (#9260)Patrick Cloke2021-02-011-122/+173
| | | | | | * Fixes a case where no summary text was returned. * The use of messages_from_person vs. messages_from_person_and_others was tweaked to depend on whether there was 1 sender or multiple senders, not based on if there was 1 room or multiple rooms.
* Clean-up the template loading code. (#9200)Patrick Cloke2021-01-271-2/+16
| | | | | * Enables autoescape by default for HTML files. * Adds a new read_template method for reading a single template. * Some logic clean-up.
* Ensure that a URL exists in the content during push. (#8965)Patrick Cloke2020-12-181-1/+5
| | | | This fixes an KeyError exception, after this PR the content is just considered unknown.
* Add type hints to the push mailer module. (#8882)Patrick Cloke2020-12-071-40/+83
|
* Fix email notifications for invites without local state. (#8627)Erik Johnston2020-10-231-13/+28
| | | | This can happen if e.g. the room invited into is no longer on the server (or if all users left the room).
* Include a simple message in email notifications that include encrypted ↵Patrick Cloke2020-10-191-5/+11
| | | | content (#8545)
* Show a confirmation page during user password reset (#8004)Andrew Morgan2020-09-101-1/+1
| | | | | This PR adds a confirmation step to resetting your user password between clicking the link in your email and your password actually being reset. This is to better align our password reset flow with the industry standard of requiring a confirmation from the user after email validation.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Use the default templates when a custom template file cannot be found (#8037)Andrew Morgan2020-08-171-71/+1
| | | Fixes https://github.com/matrix-org/synapse/issues/6583
* Allow email subjects to be customised through Synapse's configuration (#7846)Brendan Abolivier2020-07-141-31/+20
|
* Correctly pass app_name to all email templates. (#7829)Erik Johnston2020-07-141-2/+8
| | | We didn't do this for e.g. registration emails.
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-2/+1
|
* Convert sending mail to async/await. (#7557)Erik Johnston2020-05-221-47/+37
| | | | Mainly because sometimes the email push code raises exceptions where the stack traces have gotten lost, which is hopefully fixed by this.
* Fix new flake8 errors (#7470)Erik Johnston2020-05-121-2/+5
|
* Fix undefined `room_id` in `make_summary_text`Brendan Abolivier2020-03-091-1/+3
| | | | | This would break notifications about un-named rooms when processing notifications in a batch.
* Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)Patrick Cloke2020-02-211-12/+8
| | | | Ensure good comprehension hygiene using flake8-comprehensions.
* Clean up newline quote marks around the codebase (#6362)Andrew Morgan2019-11-211-2/+2
|
* Port to use state storageErik Johnston2019-10-301-1/+2
|
* Generalize email sending logging (#6075)Andrew Morgan2019-09-231-1/+1
| | | | | | | In ancient times Synapse would only send emails when it was notifying a user about a message they received... Now it can do all sorts of neat things! Change the logging so it's not just about notifications.
* Allow HS to send emails when adding an email to the HS (#6042)Andrew Morgan2019-09-201-0/+29
|
* Ensure email validation link parameters are URL-encoded (#6063)Andrew Morgan2019-09-201-4/+6
| | | The validation links sent via email had their query parameters inserted without any URL-encoding. Surprisingly this didn't seem to cause any issues, but if a user were to put a `/` in their client_secret it could lead to problems.
* Allow Synapse to send registration emails + choose Synapse or an external ↵Andrew Morgan2019-09-061-17/+66
| | | | | | | | | | | | | | | | server to handle 3pid validation (#5987) This is a combination of a few different PRs, finally all being merged into `develop`: * #5875 * #5876 * #5868 (This one added the `/versions` flag but the flag itself was actually [backed out](https://github.com/matrix-org/synapse/commit/891afb57cbdf9867f2848341b29c75d6f35eef5a#diff-e591d42d30690ffb79f63bb726200891) in #5969. What's left is just giving /versions access to the config file, which could be useful in the future) * #5835 * #5969 * #5940 Clients should not actually use the new registration functionality until https://github.com/matrix-org/synapse/pull/5972 is merged. UPGRADE.rst, changelog entries and config file changes should all be reviewed closely before this PR is merged.
* Replace returnValue with return (#5736)Amber Brown2019-07-231-50/+34
|
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-1/+1
|
* Improve email notification logging (#5502)Neil Johnson2019-06-201-1/+1
|
* Run Black. (#5482)Amber Brown2019-06-201-150/+197
|
* Change password reset links to /_matrix.Erik Johnston2019-06-111-1/+1
|
* Add ability to perform password reset via email without trusting the ↵Andrew Morgan2019-06-061-18/+67
| | | | | | | | | | | | identity server (#5377) Sends password reset emails from the homeserver instead of proxying to the identity server. This is now the default behaviour for security reasons. If you wish to continue proxying password reset requests to the identity server you must now enable the email.trust_identity_server_for_password_resets option. This PR is a culmination of 3 smaller PRs which have each been separately reviewed: * #5308 * #5345 * #5368
* Send out emails with links to extend an account's validity periodBrendan Abolivier2019-04-171-9/+5
|
* Fix logcontext leak in EmailPusherRichard van der Hoff2018-11-191-2/+3
|
* Write some tests for the email pusher (#4095)Amber Brown2018-10-301-5/+5
|
* Calculate absolute path for email templatesRichard van der Hoff2018-10-191-6/+2
|
* Ship the email templates as package_dataRichard van der Hoff2018-10-171-1/+4
| | | | | | | | | | move the example email templates into the synapse package so that they can be used as package data, which should mean that all of the packaging mechanisms (pip, docker, debian, arch, etc) should now come with the example templates. In order to grandfather in people who relied on the templates being in the old place, check for that situation and fall back to using the defaults if the templates directory does not exist.
* fix link for case that config.email_riot_base_url is setNeil Johnson2018-09-131-1/+1
|
* merge (#3576)Amber Brown2018-09-141-3/+4
|
* Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678)Amber Brown2018-08-101-1/+1
|
* run isortAmber Brown2018-07-091-16/+17
|
* Consistently use six's iteritems and wrap lazy keys/values in list() if ↵Amber Brown2018-05-311-1/+2
| | | | they're not meant to be lazy (#3307)
* Only load jinja2 templates onceErik Johnston2017-05-221-33/+54
| | | | | Instead of every time a new email pusher is created, as loading jinja2 templates is slow.
* Support authenticated SMTPDaniel Dent2017-04-051-1/+5
| | | | | | Closes (SYN-714) #1385 Signed-off-by: Daniel Dent <matrixcontrib@contactdaniel.net>
* Get current state by using current_state_events tableErik Johnston2017-03-101-1/+1
|
* Fix email push in pusher workerErik Johnston2017-02-021-2/+2
| | | | | | This was broken when device list updates were implemented, as Mailer could no longer instantiate an AuthHandler due to a dependency on federation sending.
* Allow configuring the Riot URL used in notification emailsAdrian Perez de Castro2017-01-131-6/+14
| | | | | | | | | | The URLs used for notification emails were hardcoded to use either matrix.to or vector.im; but for self-hosted setups where Riot is also self-hosted it may be desirable to allow configuring an alternative Riot URL. Fixes #1809. Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
* Fix push notifications for a single unread messageErik Johnston2016-10-181-1/+1
|
* Fix email push notifs being droppedErik Johnston2016-10-131-14/+25
| | | | | | | | A lot of email push notifications were failing to be sent due to an exception being thrown along one of the (many) paths. This was due to a change where we moved from pulling out the full state for each room, but rather pulled out the event ids for the state and separately loaded the full events when needed.
* Fix email notifs by adding missing paramErik Johnston2016-08-301-1/+1
|
* Fix room name in email notifsErik Johnston2016-08-261-19/+20
|
* Fix up push to use get_current_state_idsErik Johnston2016-08-251-13/+19
|
* Fix ``KeyError: 'msgtype'``. Use ``.get``Mark Haines2016-06-171-14/+15
| | | | | | | | | | | | | Fixes a key error where the mailer tried to get the ``msgtype`` of an event that was missing a ``msgtype``. ``` File "synapse/push/mailer.py", line 264, in get_notif_vars File "synapse/push/mailer.py", line 285, in get_message_vars File ".../frozendict/__init__.py", line 10, in __getitem__ return self.__dict[key] KeyError: 'msgtype' ```
* 3rd time lucky: we'd already calculated it aboveDavid Baker2016-06-031-3/+1
|
* Oops, we're using the dict formDavid Baker2016-06-031-1/+3
|
* Add substitutions to email notif FromDavid Baker2016-06-031-1/+1
|
* Merge branch 'develop' into matthew/brand-from-headerMatthew Hodgson2016-06-031-6/+19
|\
| * Merge pull request #821 from matrix-org/dbkr/email_unsubscribeDavid Baker2016-06-021-5/+18
| |\ | | | | | | Email unsubscribe links that don't require logging in
| | * peppateDavid Baker2016-06-021-1/+3
| | |
| | * Working unsubscribe links going straight to the HSDavid Baker2016-06-021-4/+4
| | | | | | | | | | | | and authed by macaroons that let you delete pushers and nothing else
| | * Merge remote-tracking branch 'origin/dbkr/email_notif_string_fmt_error' into ↵David Baker2016-06-021-1/+1
| | |\ | | | | | | | | | | | | dbkr/email_unsubscribe
| | * \ Merge remote-tracking branch 'origin/develop' into dbkr/email_unsubscribeDavid Baker2016-06-021-2/+2
| | |\ \
| | * \ \ Merge branch 'dbkr/split_out_auth_handler' into dbkr/email_unsubscribeDavid Baker2016-06-021-0/+2
| | |\ \ \
| | * | | | Email unsubscribing that may in theory, workDavid Baker2016-06-021-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | Were it not for that fact that you can't use the base handler in the pusher because it pulls in the world. Comitting while I fix that on a different branch.
| * | | | | Merge pull request #820 from matrix-org/dbkr/email_notif_string_fmt_errorDavid Baker2016-06-021-1/+1
| |\ \ \ \ \ | | | |_|_|/ | | |/| | | Fix error in email notification string formatting
| | * | | | Fix error in email notification string formattingDavid Baker2016-06-021-1/+1
| | | |_|/ | | |/| |
* | / | | brand the email from headerMatthew Hodgson2016-06-021-1/+8
|/ / / /
* / / / add some branding debuggingMatthew Hodgson2016-06-021-0/+1
|/ / /
* | / if an email pusher specifies a brand param, use itMatthew Hodgson2016-06-021-2/+2
| |/ |/|
* | Use user_id in email greeting if display name is nullDavid Baker2016-06-021-0/+2
|/
* Check for presence of 'avatar_url' keyDavid Baker2016-05-241-1/+3
|
* fix NPE in room orderingMatthew Hodgson2016-05-231-2/+2
|
* consistency is the better part of valourMatthew Hodgson2016-05-231-1/+1
|
* Tune email notifs to make them quieter:Matthew Hodgson2016-05-231-10/+38
| | | | | | | | * After initial 10 minute window, only alert every 24h for room notifs * Reset room state after 6h of idleness * Synchronise throttles for messages sent in the same notif, so the 24 hourly notifs 'line up' * Fix the email subjects to say what triggered the notification * Order the rooms in reverse activity order in the email, so the 'reason' room should always come first
* tune email notifs, fix CSS a bit, and add debugging detailsMatthew Hodgson2016-05-161-1/+6
|
* fix matrix.to URLsMatthew Hodgson2016-05-131-2/+2
|
* Make email notifs work on the pusher synapseDavid Baker2016-05-131-0/+1
| | | | Plus general bugfix to email notif code
* move filter_events_for_client out of base handlerMark Haines2016-05-111-3/+3
|
* Make pep8 happyDavid Baker2016-05-101-1/+1
|
* Switch from CSS to Table layout for HTML mails so they work in Outlook ↵Matthew Hodgson2016-05-101-7/+18
| | | | | | | aka Word Remove templates-vector and theme templates with variables instead Switch to matrix.to URLs by default for links
* better mail subject linesMatthew Hodgson2016-05-051-1/+1
|
* fix layout; handle app naming in synapse, not jinjaMatthew Hodgson2016-05-051-16/+31
|
* pep8Matthew Hodgson2016-05-051-2/+4
|
* handle fragments correctly on mxc URLs.Matthew Hodgson2016-05-051-14/+45
| | | | | | | switch to vector.im permalinks as matrix.to isn't ready yet. merge overlapping notifications together. give one message of context after a notification (in the unlikely event it exists, but it's possible thanks to throttling). include name of app in mail templates
* Include no contextDavid Baker2016-05-041-1/+1
| | | | until we can de-dup between the context and other notifs
* Add date header & message idDavid Baker2016-05-041-0/+2
|
* Use the constantDavid Baker2016-04-291-1/+2
|
* Avoid `vars` builtinDavid Baker2016-04-291-15/+15
|
* Use named parameter formatDavid Baker2016-04-291-14/+22
|
* pep8David Baker2016-04-291-1/+0
|
* Send mail notifs with a plaintext part tooDavid Baker2016-04-291-7/+20
|
* May as well always include room linkDavid Baker2016-04-281-4/+3
|
* Support file messages & fix plain textDavid Baker2016-04-281-2/+3
|
* Support image notifsDavid Baker2016-04-281-11/+25
|
* pep8David Baker2016-04-281-2/+5
|
* Handle room invites in email notifsDavid Baker2016-04-281-5/+30
|
* Linkify plain text messages tooDavid Baker2016-04-281-1/+12
|
* Run filter_events_for_clientDavid Baker2016-04-271-7/+11
| | | | so we don't accidentally mail out events people shouldn't see
* Make html messages workDavid Baker2016-04-271-10/+21
|
* Better grammar for multiple messages in a roomDavid Baker2016-04-271-9/+32
| | | | Say who the messages are from if there's no room name, otherwise it's a bit nonsensical
* Hopefully all remaining bits for email notifsDavid Baker2016-04-271-22/+144
| | | | Add public facing base url to the server so synapse knows what URL to use when converting mxc to http urls for use in emails
* More variable calculation for email notifsDavid Baker2016-04-251-2/+55
| | | | Include name of the person we're sending to and add summary text at the top giving an overview of what's happened.
* Actually do UTF8 correctlyDavid Baker2016-04-221-1/+1
|
* Mime part is binary so encode it first.David Baker2016-04-221-1/+1
| | | | Doesn't get character enocind right yet but makes it not error.
* Flesh out email templatingDavid Baker2016-04-211-3/+58
| | | | Mostly WIP porting the room name calculation logic from the web client so our room names in the email mirror the clients.
* Generate mails from a templateDavid Baker2016-04-201-13/+17
|
* more pep8David Baker2016-04-201-1/+1
|
* Send a rather basic email notifDavid Baker2016-04-201-0/+48
Also pep8 fixes