MCPcopy
hub / github.com/django/django / _add_attachments

Method _add_attachments

django/core/mail/message.py:489–505  ·  view source on GitHub ↗
(self, msg)

Source from the content-addressed store, hash-verified

487 msg.set_content(body, subtype=self.content_subtype, charset=encoding)
488
489 def _add_attachments(self, msg):
490 if self.attachments:
491 if hasattr(self, "mixed_subtype"):
492 # RemovedInDjango70Warning.
493 raise AttributeError(
494 "EmailMessage no longer supports the"
495 " undocumented `mixed_subtype` attribute"
496 )
497 msg.make_mixed()
498 for attachment in self.attachments:
499 if isinstance(attachment, email.message.MIMEPart):
500 msg.attach(attachment)
501 elif isinstance(attachment, MIMEBase):
502 # RemovedInDjango70Warning.
503 msg.attach(attachment)
504 else:
505 self._add_attachment(msg, *attachment)
506
507 def _add_attachment(self, msg, filename, content, mimetype):
508 encoding = self.encoding or settings.DEFAULT_CHARSET

Callers 1

messageMethod · 0.95

Calls 2

_add_attachmentMethod · 0.95
attachMethod · 0.80

Tested by

no test coverage detected