MCPcopy Index your code
hub / github.com/python/cpython / MIMEMultipart

Class MIMEMultipart

Lib/email/mime/multipart.py:12–47  ·  view source on GitHub ↗

Base class for MIME multipart/* type messages.

Source from the content-addressed store, hash-verified

10
11
12class MIMEMultipart(MIMEBase):
13 """Base class for MIME multipart/* type messages."""
14
15 def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
16 *, policy=None,
17 **_params):
18 """Creates a multipart/* type message.
19
20 By default, creates a multipart/mixed message, with proper
21 Content-Type and MIME-Version headers.
22
23 _subtype is the subtype of the multipart content type, defaulting to
24 'mixed'.
25
26 boundary is the multipart boundary string. By default it is
27 calculated as needed.
28
29 _subparts is a sequence of initial subparts for the payload. It
30 must be an iterable object, such as a list. You can always
31 attach new subparts to the message by using the attach() method.
32
33 Additional parameters for the Content-Type header are taken from the
34 keyword arguments (or passed into the _params argument).
35 """
36 MIMEBase.__init__(self, 'multipart', _subtype, policy=policy, **_params)
37
38 # Initialise _payload to an empty list as the Message superclass's
39 # implementation of is_multipart assumes that _payload is a list for
40 # multipart messages.
41 self._payload = []
42
43 if _subparts:
44 for p in _subparts:
45 self.attach(p)
46 if boundary:
47 self.set_boundary(boundary)

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…