mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Fixed crasher when sending rfc822 messages as attachments. (#59)
This commit is contained in:
@@ -171,6 +171,12 @@ class Attachment(object):
|
||||
if isinstance(attachment, MIMEBase):
|
||||
self.name = attachment.get_filename()
|
||||
self.content = attachment.get_payload(decode=True)
|
||||
if self.content is None:
|
||||
if hasattr(attachment, 'as_bytes'):
|
||||
self.content = attachment.as_bytes()
|
||||
else:
|
||||
# Python 2.7 fallback
|
||||
self.content = attachment.as_string().encode(self.encoding)
|
||||
self.mimetype = attachment.get_content_type()
|
||||
|
||||
if get_content_disposition(attachment) == 'inline':
|
||||
|
||||
Reference in New Issue
Block a user