Skip to content

Migrate email notification system to use Django's native EmailMessage #5320

@mauromsl

Description

@mauromsl

Is your feature request related to a problem? Please describe.
Janeway's notification system uses the dataclass EmailData when passing email context between views, events and the notification system. Then, it relies on 1st order functions to handle the actual email sending logic. The django team discourages using the internal email api (in particular sanitize_address) as it is not documented. Instead, the recommendation is to use the EmailMessage class which encapsulates both data and behaviour

Describe the solution you'd like

  • Find references to EmailData and swap them for EmailMessage
  • Find notifications receiving EmailData as an argument and swap calls to the first order functions like send_message() for calls to the EmailMessage api (e.g EmailMessage.send())
  • If time allows, find any other email notifications not yet using EmailData but that still rely on sanitize_address() and make use of EmailMessage instead

Additional context
Django's sanitize_address can result on an invalid header with linebreaks when running Django<4.2 or janeway<1.9 (https://code.djangoproject.com/ticket/32008)

Metadata

Metadata

Assignees

Labels

bugSomething's not workingnew featureA new thing that doesn't exist yet

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions