Skip to content

Commit

Permalink
feat: added support for headers in DjangoEmailChannel (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadadeeltajamul authored Jul 1, 2024
1 parent 9644543 commit 38c4e18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edx_ace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .recipient import Recipient
from .recipient_resolver import RecipientResolver

__version__ = '1.9.0'
__version__ = '1.9.1'


__all__ = [
Expand Down
1 change: 1 addition & 0 deletions edx_ace/channel/django_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def deliver(self, message, rendered_message):
from_email=from_address,
to=[message.recipient.email_address],
reply_to=reply_to,
headers=message.headers,
)

mail.attach_alternative(rendered_template, 'text/html')
Expand Down
7 changes: 7 additions & 0 deletions edx_ace/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class Message(MessageAttributeSerializationMixin, metaclass=ABCMeta):
default=None
)
options = attr.ib()

# headers are only supported for DjangoEmailChannel
headers = attr.ib()
language = attr.ib(default=None)
log_level = attr.ib(default=None)

Expand All @@ -84,6 +87,10 @@ def default_context_value(self):
def default_options_value(self):
return {}

@headers.default
def default_headers_value(self):
return {}

@uuid.default
def generate_uuid(self):
return uuid4()
Expand Down

0 comments on commit 38c4e18

Please sign in to comment.