]>
Commit | Line | Data |
---|---|---|
4710c53d | 1 | # Copyright (C) 2001-2006 Python Software Foundation\r |
2 | # Author: Barry Warsaw\r | |
3 | # Contact: email-sig@python.org\r | |
4 | \r | |
5 | """Class representing text/* type MIME documents."""\r | |
6 | \r | |
7 | __all__ = ['MIMEText']\r | |
8 | \r | |
9 | from email.encoders import encode_7or8bit\r | |
10 | from email.mime.nonmultipart import MIMENonMultipart\r | |
11 | \r | |
12 | \r | |
13 | \f\r | |
14 | class MIMEText(MIMENonMultipart):\r | |
15 | """Class for generating text/* type MIME documents."""\r | |
16 | \r | |
17 | def __init__(self, _text, _subtype='plain', _charset='us-ascii'):\r | |
18 | """Create a text/* type MIME document.\r | |
19 | \r | |
20 | _text is the string for this message object.\r | |
21 | \r | |
22 | _subtype is the MIME sub content type, defaulting to "plain".\r | |
23 | \r | |
24 | _charset is the character set parameter added to the Content-Type\r | |
25 | header. This defaults to "us-ascii". Note that as a side-effect, the\r | |
26 | Content-Transfer-Encoding header will also be set.\r | |
27 | """\r | |
28 | MIMENonMultipart.__init__(self, 'text', _subtype,\r | |
29 | **{'charset': _charset})\r | |
30 | self.set_payload(_text, _charset)\r |