#27848: .eml could not be attached to EmailMessage
-----------------------------+--------------------------------------
     Reporter:  doudz        |                    Owner:  nobody
         Type:  Bug          |                   Status:  new
    Component:  Core (Mail)  |                  Version:  1.9
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------
Description changed by doudz:

Old description:

> .eml file could not be attached to EmailMessage using .attach_file()
> because it raise the following error :
> initial_value must be str or None, not bytes
>
> maybe related to mimetype message/rfc822
>
> {{{
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/message.py", line 292, in send return
> self.get_connection(fail_silently).send_messages([self])
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/backends/smtp.py", line 107, in send_messages
> sent = self._send(message)
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/backends/smtp.py", line 121, in _send message =
> email_message.message()
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/message.py", line 256, in message msg =
> self._create_message(msg)
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/message.py", line 344, in _create_message
> return self._create_attachments(msg)
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/message.py", line 357, in _create_attachments
> msg.attach(self._create_attachment(*attachment)) File
> "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py",
> line 399, in _create_attachment attachment =
> self._create_mime_attachment(content, mimetype)
> File "/usr/local/lib/python3.5/dist-
> packages/django/core/mail/message.py", line 380, in
> _create_mime_attachment content = message_from_string(content) File
> "/usr/lib/python3.5/email/__init__.py", line 38, in message_from_string
> return Parser(*args, **kws).parsestr(s)
> File "/usr/lib/python3.5/email/parser.py", line 68, in parsestr return
> self.parse(StringIO(text), headersonly=headersonly)
> TypeError: initial_value must be str or None, not bytes
> }}}

New description:

 .eml file could not be attached to EmailMessage using .attach_file()
 because it raise the following error :
 initial_value must be str or None, not bytes

 maybe related to mimetype message/rfc822

 {{{
 File "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py",
 line 292, in send return
 self.get_connection(fail_silently).send_messages([self])
 File "/usr/local/lib/python3.5/dist-
 packages/django/core/mail/backends/smtp.py", line 107, in send_messages
 sent = self._send(message)
 File "/usr/local/lib/python3.5/dist-
 packages/django/core/mail/backends/smtp.py", line 121, in _send message =
 email_message.message()
 File "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py",
 line 256, in message msg = self._create_message(msg)
 File "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py",
 line 344, in _create_message return self._create_attachments(msg)
 File "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py",
 line 357, in _create_attachments
 msg.attach(self._create_attachment(*attachment)) File
 "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py", line
 399, in _create_attachment attachment =
 self._create_mime_attachment(content, mimetype)
 File "/usr/local/lib/python3.5/dist-packages/django/core/mail/message.py",
 line 380, in _create_mime_attachment content =
 message_from_string(content)
 File "/usr/lib/python3.5/email/__init__.py", line 38, in
 message_from_string return Parser(*args, **kws).parsestr(s)
 File "/usr/lib/python3.5/email/parser.py", line 68, in parsestr return
 self.parse(StringIO(text), headersonly=headersonly)
 TypeError: initial_value must be str or None, not bytes
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27848#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.57ad0f1d066258c04957ff23ab4362dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to