mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Fix: html messages were sent as text
If you followed the instructions at: <https://docs.djangoproject.com/en/1.5/topics/email/#sending-alternative-content-types>, djrill would send the body as 'text' instead of 'html', resulting in ugly emails. This also fixes how `[auto_text]` could be set, but couldn't do anything. If you wanted to use `auto_text=True`, you would have to send a null body and then `attach_alternative` your real body. I didn't add a test case for this because they're like... orthogonal..., and gets into behavior testing vs unit testing. [auto_text]: https://djrill.readthedocs.org/en/master/usage/sending_mail/#auto_text
This commit is contained in:
@@ -112,8 +112,9 @@ class DjrillBackend(BaseEmailBackend):
|
|||||||
to_list = [{"email": to_email, "name": to_name}
|
to_list = [{"email": to_email, "name": to_name}
|
||||||
for (to_name, to_email) in parsed_rcpts]
|
for (to_name, to_email) in parsed_rcpts]
|
||||||
|
|
||||||
|
content = "html" if message.content_subtype == "html" else "text"
|
||||||
msg_dict = {
|
msg_dict = {
|
||||||
"text": message.body,
|
content: message.body,
|
||||||
"subject": message.subject,
|
"subject": message.subject,
|
||||||
"from_email": from_email,
|
"from_email": from_email,
|
||||||
"to": to_list
|
"to": to_list
|
||||||
|
|||||||
Reference in New Issue
Block a user