1 # Copyright (C) 2002 Python Software Foundation
2 # Author: barry@zope.com (Barry Warsaw)
4 """Base class for MIME multipart/* type messages.
7 from email
import MIMEBase
11 class MIMEMultipart(MIMEBase
.MIMEBase
):
12 """Base class for MIME multipart/* type messages."""
14 def __init__(self
, _subtype
='mixed', boundary
=None, *_subparts
, **_params
):
15 """Creates a multipart/* type message.
17 By default, creates a multipart/mixed message, with proper
18 Content-Type and MIME-Version headers.
20 _subtype is the subtype of the multipart content type, defaulting to
23 boundary is the multipart boundary string. By default it is
26 _subparts is a sequence of initial subparts for the payload. It
27 must be possible to convert this sequence to a list. You can always
28 attach new subparts to the message by using the attach() method.
30 Additional parameters for the Content-Type header are taken from the
31 keyword arguments (or passed into the _params argument).
33 MIMEBase
.MIMEBase
.__init
__(self
, 'multipart', _subtype
, **_params
)
35 self
.attach(*list(_subparts
))
37 self
.set_boundary(boundary
)