\verbatiminput{email-mime.py}
-Here's an example\footnote{Thanks to Matthew Dixon Cowles for the
-original inspiration and examples.} of how to send the entire contents
-of a directory as an email message:
+Here's an example of how to send the entire contents of a directory as
+an email message:
+\footnote{Thanks to Matthew Dixon Cowles for the original inspiration
+ and examples.}
\verbatiminput{email-dir.py}
\begin{methoddesc}[Charset]{__str__}{}
Returns \var{input_charset} as a string coerced to lower case.
+\method{__repr__()} is an alias for \method{__str__()}.
\end{methoddesc}
\begin{methoddesc}[Charset]{__eq__}{other}
Here is the \class{Header} class description:
\begin{classdesc}{Header}{\optional{s\optional{, charset\optional{,
- maxlinelen\optional{, header_name\optional{, continuation_ws}}}}}}
+ maxlinelen\optional{, header_name\optional{, continuation_ws\optional{,
+ errors}}}}}}}
Create a MIME-compliant header that can contain strings in different
character sets.
This character will be prepended to continuation lines.
\end{classdesc}
-\begin{methoddesc}[Header]{append}{s\optional{, charset}}
+Optional \var{errors} is passed straight through to the
+\method{append()} method.
+
+\begin{methoddesc}[Header]{append}{s\optional{, charset\optional{, errors}}}
Append the string \var{s} to the MIME header.
Optional \var{charset}, if given, should be a \class{Charset} instance
rules, the Unicode string will be encoded using the following charsets
in order: \code{us-ascii}, the \var{charset} hint, \code{utf-8}. The
first character set to not provoke a \exception{UnicodeError} is used.
+
+Optional \var{errors} is passed through to any \function{unicode()} or
+\function{ustr.encode()} call, and defaults to ``strict''.
\end{methoddesc}
-\begin{methoddesc}[Header]{encode}{}
+\begin{methoddesc}[Header]{encode}{\optional{splitchars}}
Encode a message header into an RFC-compliant format, possibly
wrapping long lines and encapsulating non-\ASCII{} parts in base64 or
-quoted-printable encodings.
+quoted-printable encodings. Optional \var{splitchars} is a string
+containing characters to split long ASCII lines on, in rough support
+of \rfc{2822}'s \emph{highest level syntactic breaks}. This doesn't
+affect \rfc{2047} encoded lines.
\end{methoddesc}
The \class{Header} class also provides a number of methods to support
provides some useful higher level iterations over message object
trees.
-\begin{funcdesc}{body_line_iterator}{msg}
+\begin{funcdesc}{body_line_iterator}{msg\optional{, decode}}
This iterates over all the payloads in all the subparts of \var{msg},
returning the string payloads line-by-line. It skips over all the
subpart headers, and it skips over any subpart with a payload that
isn't a Python string. This is somewhat equivalent to reading the
flat text representation of the message from a file using
\method{readline()}, skipping over all the intervening headers.
+
+Optional \var{decode} is passed through to \method{Message.get_payload()}.
\end{funcdesc}
\begin{funcdesc}{typed_subpart_iterator}{msg\optional{,
decoded if this header's value is \samp{quoted-printable} or
\samp{base64}. If some other encoding is used, or
\mailheader{Content-Transfer-Encoding} header is
-missing, the payload is returned as-is (undecoded). If the message is
-a multipart and the \var{decode} flag is \code{True}, then \code{None} is
-returned. The default for \var{decode} is \code{False}.
+missing, or if the payload has bogus base64 data, the payload is
+returned as-is (undecoded). If the message is a multipart and the
+\var{decode} flag is \code{True}, then \code{None} is returned. The
+default for \var{decode} is \code{False}.
\end{methoddesc}
\begin{methoddesc}[Message]{set_payload}{payload\optional{, charset}}
minor type and defaults to \mimetype{plain}. \var{_charset} is the
character set of the text and is passed as a parameter to the
\class{MIMENonMultipart} constructor; it defaults to \code{us-ascii}. No
-guessing or encoding is performed on the text data, but a newline is
-appended to \var{_text} if it doesn't already end with a newline.
+guessing or encoding is performed on the text data.
\deprecated{2.2.2}{The \var{_encoding} argument has been deprecated.
Encoding now happens implicitly based on the \var{_charset} argument.}