python-2.5.2/win32/Lib/email/mime/multipart.py
changeset 0 ae805ac0140d
equal deleted inserted replaced
-1:000000000000 0:ae805ac0140d
       
     1 # Copyright (C) 2002-2006 Python Software Foundation
       
     2 # Author: Barry Warsaw
       
     3 # Contact: email-sig@python.org
       
     4 
       
     5 """Base class for MIME multipart/* type messages."""
       
     6 
       
     7 __all__ = ['MIMEMultipart']
       
     8 
       
     9 from email.mime.base import MIMEBase
       
    10 
       
    11 
       
    12 
       
    13 class MIMEMultipart(MIMEBase):
       
    14     """Base class for MIME multipart/* type messages."""
       
    15 
       
    16     def __init__(self, _subtype='mixed', boundary=None, _subparts=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, **_params)
       
    37         if _subparts:
       
    38             for p in _subparts:
       
    39                 self.attach(p)
       
    40         if boundary:
       
    41             self.set_boundary(boundary)