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:
crccheck
2013-09-26 15:32:26 -05:00
parent f5465700a8
commit 393d6e7fa8

View File

@@ -112,8 +112,9 @@ class DjrillBackend(BaseEmailBackend):
to_list = [{"email": to_email, "name": to_name}
for (to_name, to_email) in parsed_rcpts]
content = "html" if message.content_subtype == "html" else "text"
msg_dict = {
"text": message.body,
content: message.body,
"subject": message.subject,
"from_email": from_email,
"to": to_list