Opened 18 years ago
Closed 18 years ago
#4835 closed (invalid)
EmailMultiAlternatives doesn't render unicode html well
| Reported by: | anonymous | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Core (Mail) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
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
Change History (2)
comment:1 by , 18 years ago
| Component: | Core framework → django.core.mail |
|---|
comment:2 by , 18 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.