#4906: EmailMultiAlternatives.send() raise coercing to Unicode when bcc is None -----------------------------+---------------------------------------------- Reporter: [EMAIL PROTECTED] | Owner: adrian Status: new | Component: Core framework Version: SVN | Keywords: Stage: Unreviewed | Has_patch: 0 -----------------------------+---------------------------------------------- Hi, Following http://www.djangoproject.com/documentation/email/, I have tried the example : {{{ from django.core.mail import EmailMultiAlternatives subject, from_email, to = 'hello', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]' text_content = 'This is an important message.' html_content = '<p>This is an <strong>important</strong> message.' msg = EmailMultiAlternatives(subject, text_content, from_email, to) msg.attach_alternative(html_content, "text/html") msg.send() }}} This raise a "cannot concatenate 'str' and 'list' objects" error. The exception is raised by {{{ return self.to + self.bcc }}} (line 251 in mail.py) because bcc is set to [] by default (line 209 of mail.py) and in this example to is a string. To fix this I had to use {{{['[EMAIL PROTECTED]']}}} instead of {{{'[EMAIL PROTECTED]'}}} Another solution is to changed {{{__init__()}}} to force {{{self.to}}} and {{{self.bcc}}} to being list.
-- Ticket URL: <http://code.djangoproject.com/ticket/4906> Django Code <http://code.djangoproject.com/> The web framework for perfectionists with deadlines --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
