RELEASED email package version 1.2
Barry A. Warsaw
barry at zope.com
Mon Mar 18 18:26:49 CET 2002
I've released the standalone email package version 1.2. This version
has much better support RFC 2047, especially when using multibyte
character sets (much thanks go to Ben Gertzfield). A NEWS file
excerpt is included below.
I will eventually be merging this code into the Python distro, but
there are a few new features I want to look at first. One of them
includes RFC 2231 support (written by Oleg Broytmann).
You can get the standalone email package from SourceForge:
Bug reports to this project please, not to the Python bug tracker
(until this code is merged into the Python distro).
-------------------- snip snip --------------------
- In the MIMEText class's constructor, the _encoder argument is
deprecated. You will get a DeprecationWarning if you try to use
it. This is because there is a fundamental conflict between
_encoder and the fact that _charset is passed to the underlying
set_payload() method. _encoder really makes no sense any more.
- When Message.set_type() is used to set the Content-Type: header,
the MIME-Version: header is always set (overriding any existing
- More liberal acceptance of parameter formatting, e.g. this is
now accepted: Content-Type: multipart/mixed; boundary = "FOO"
I.e. spaces around the = sign.
- Bug fix in Generator related to splitting long lines in a
- In class Charset, __str__() method added, as were __eq__() and
- Charset.get_body_encoding() may now return a function as well as
a string character set name. The function takes a single
argument, which is a Message instance, and may change the
Content-Transfer-Encoding: header (or do any other manipulations
on the message).
- Charset.from_splittable() added argument to_output which is used
to specify whether the input_codec or the output_codec is used
for the conversion (by default, the output codec is used).
- No changes since 0.97. Only the version number has changed.
- Message.set_charset() can now take a string naming a character
set in addition to a Charset instance. In the former case, a
Charset is instantiated by passing the string to its
- The MIMEText constructor now passes the _charset argument to the
underlying set_charset() method. This makes things consistent
at the cost of a minor semantic change: the resulting instance
will have a Content-Transfer-Encoding: header where previously
it did not.
- A fix for a crash when quopriMIME.encode() tried to encode a
multiline string containing a blank line.
- New module Header.py which provides a higher level interface for
encoded email headers, such as Subject:, From:, and To:. This
module provides an abstraction for composing such headers out of
charset encoded parts, and for decoding such headers. It
properly splits lines on character boundaries even for multibyte
- New RFC compliant base64 and quoted-printable modules, called
base64MIME.py and quopriMIME.py. These are intended to replace
the Python standard base64.py and quopri.py modules, but are
geared toward their use conformant to the various MIME email
- The Message class is much more character set aware and RFC
+ set_payload() now takes a new optional charset argument
+ New methods set_charset(), get_charset(), set_param(),
+ Header parameter quoting is more RFC compliant
+ get_param() and get_params() now take a new optional unquote
- The Charset module now knows about utf-8, gb2132, and big5
codecs, the latter two of which are available independently of
Python (see the comments in this module for downloading Chinese,
Japanese, and Korean codecs).
New Charset methods get_body_encoding(), get_output_charset(),
encoded_header_len(), header_encode(), and body_encode().
- The Generator now handles encoding the body, if the message
object has a character set.
- The Utils module has new functions fix_eols() and make_msgid().
It also includes a workaround for bugs in parseaddr() when used
with Python versions before 2.2.
- A fix for a Parser bug when parsing multipart/* parts that
contain only a single subpart.
More information about the Python-list