Code

Opened 7 years ago

Closed 7 years ago

#4835 closed (invalid)

EmailMultiAlternatives doesn't render unicode html well

Reported by: anonymous Owned by: adrian
Component: Core (Mail) Version: master
Severity: Keywords: mail
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The following code doesn't render the HTML message well

from django.core.mail import EmailMultiAlternatives
from django.template import Context, Template

test_string = u'éàèèèççççaaaa'


t = Template("Here is a string {{ test_string }}.")
c = Context({"test_string": test_string })

message_html = t.render(c)

subject, from_email, to = 'hello', 'from@example.com', 'to@example.com'
text_content = u'Here is a string %s' % test_string
html_content = message_html
msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html")
msg.send()

Text message is OK but the HTML is not

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by anonymous

  • Component changed from Core framework to django.core.mail
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 7 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.