2004-10-03 03:16:19 +00:00
|
|
|
|
# Copyright (C) 2001-2004 Python Software Foundation
|
|
|
|
|
# Author: Barry Warsaw
|
|
|
|
|
# Contact: email-sig@python.org
|
2001-09-23 03:17:28 +00:00
|
|
|
|
|
2004-10-03 03:16:19 +00:00
|
|
|
|
"""Class representing text/* type MIME documents."""
|
2001-09-23 03:17:28 +00:00
|
|
|
|
|
2002-06-02 19:05:08 +00:00
|
|
|
|
from email.MIMENonMultipart import MIMENonMultipart
|
|
|
|
|
from email.Encoders import encode_7or8bit
|
2001-09-23 03:17:28 +00:00
|
|
|
|
|
|
|
|
|
|
2001-10-04 17:05:11 +00:00
|
|
|
|
|
2002-06-02 19:05:08 +00:00
|
|
|
|
class MIMEText(MIMENonMultipart):
|
2001-09-23 03:17:28 +00:00
|
|
|
|
"""Class for generating text/* type MIME documents."""
|
|
|
|
|
|
2004-10-03 03:16:19 +00:00
|
|
|
|
def __init__(self, _text, _subtype='plain', _charset='us-ascii'):
|
2001-09-23 03:17:28 +00:00
|
|
|
|
"""Create a text/* type MIME document.
|
|
|
|
|
|
2003-03-11 05:04:09 +00:00
|
|
|
|
_text is the string for this message object.
|
2001-09-23 03:17:28 +00:00
|
|
|
|
|
2001-09-26 05:34:30 +00:00
|
|
|
|
_subtype is the MIME sub content type, defaulting to "plain".
|
2001-09-23 03:17:28 +00:00
|
|
|
|
|
2002-10-01 00:52:27 +00:00
|
|
|
|
_charset is the character set parameter added to the Content-Type
|
2002-04-10 21:01:31 +00:00
|
|
|
|
header. This defaults to "us-ascii". Note that as a side-effect, the
|
2002-10-01 00:52:27 +00:00
|
|
|
|
Content-Transfer-Encoding header will also be set.
|
2001-09-23 03:17:28 +00:00
|
|
|
|
"""
|
2002-06-02 19:05:08 +00:00
|
|
|
|
MIMENonMultipart.__init__(self, 'text', _subtype,
|
|
|
|
|
**{'charset': _charset})
|
2002-04-10 21:01:31 +00:00
|
|
|
|
self.set_payload(_text, _charset)
|