1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #28042 -- Fixed crash when using a two-tuple in EmailMessage's attachments arg.

This commit is contained in:
kalombo
2017-04-07 15:23:25 +05:00
committed by Tim Graham
parent aedfe0ddd7
commit dd00184892
3 changed files with 17 additions and 1 deletions

View File

@@ -236,7 +236,13 @@ class EmailMessage:
self.from_email = from_email or settings.DEFAULT_FROM_EMAIL
self.subject = subject
self.body = body
self.attachments = attachments or []
self.attachments = []
if attachments:
for attachment in attachments:
if isinstance(attachment, MIMEBase):
self.attach(attachment)
else:
self.attach(*attachment)
self.extra_headers = headers or {}
self.connection = connection