1 # Copyright (C) 2001-2004 Python Software Foundation
3 # Contact: email-sig@python.org
5 """Class representing text/* type MIME documents."""
7 from email
.MIMENonMultipart
import MIMENonMultipart
8 from email
.Encoders
import encode_7or8bit
12 class MIMEText(MIMENonMultipart
):
13 """Class for generating text/* type MIME documents."""
15 def __init__(self
, _text
, _subtype
='plain', _charset
='us-ascii'):
16 """Create a text/* type MIME document.
18 _text is the string for this message object.
20 _subtype is the MIME sub content type, defaulting to "plain".
22 _charset is the character set parameter added to the Content-Type
23 header. This defaults to "us-ascii". Note that as a side-effect, the
24 Content-Transfer-Encoding header will also be set.
26 MIMENonMultipart
.__init
__(self
, 'text', _subtype
,
27 **{'charset': _charset
})
28 self
.set_payload(_text
, _charset
)