c 20022006 python software foundation barry warsaw contact emailsigpython org base class for mime multipart type messages all mimemultipart from email mime base import mimebase class mimemultipartmimebase creates a multipart type message by default creates a multipartmixed message with proper contenttype and mimeversion headers subtype is the subtype of the multipart content type defaulting to mixed boundary is the multipart boundary string by default it is calculated as needed subparts is a sequence of initial subparts for the payload it must be an iterable object such as a list you can always attach new subparts to the message by using the attach method additional parameters for the contenttype header are taken from the keyword arguments or passed into the params argument initialise payload to an empty list as the message superclass s implementation of ismultipart assumes that payload is a list for multipart messages c 2002 2006 python software foundation barry warsaw contact email sig python org base class for mime multipart type messages base class for mime multipart type messages creates a multipart type message by default creates a multipart mixed message with proper content type and mime version headers _subtype is the subtype of the multipart content type defaulting to mixed boundary is the multipart boundary string by default it is calculated as needed _subparts is a sequence of initial subparts for the payload it must be an iterable object such as a list you can always attach new subparts to the message by using the attach method additional parameters for the content type header are taken from the keyword arguments or passed into the _params argument initialise _payload to an empty list as the message superclass s implementation of is_multipart assumes that _payload is a list for multipart messages
__all__ = ['MIMEMultipart']

from email.mime.base import MIMEBase


class MIMEMultipart(MIMEBase):
    

    def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
                 *, policy=None,
                 **_params):
        
        MIMEBase.__init__(self, 'multipart', _subtype, policy=policy, **_params)

        
        
        
        self._payload = []

        if _subparts:
            for p in _subparts:
                self.attach(p)
        if boundary:
            self.set_boundary(boundary)