messages/email_.py
def _add_attachments(self):
        """Add required attachments."""
        num_attached = 0
        if self.attachments:
            if isinstance(self.attachments, str):
                self.attachments = [self.attachments]

            for item in self.attachments:
                doc = MIMEApplication(open(item, "rb").read())
                doc.add_header("Content-Disposition", "attachment", filename=item)
                self.message.attach(doc)
                num_attached += 1
        return num_attached
def _add_attachments(self):
        """Add required attachments."""
        num_attached = 0
        if self.attachments:
            if isinstance(self.attachments, str):
                self.attachments = [self.attachments]

            for item in self.attachments:
                doc = MIMEApplication(open(item, "rb").read())
                doc.add_header("Content-Disposition", "attachment", filename=item)
                self.message.attach(doc)
                num_attached += 1
        return num_attached
Add required attachments.