Message Objects

A Message instance has the following methods:


\begin{funcdesc}{rewindbody}{}
Seek to the start of the message body. This only works if the file
object is seekable.
\end{funcdesc}


\begin{funcdesc}{getallmatchingheaders}{name}
Return a list of lines consisting ...
...list item. Return the empty list if no
header matches \var{name}.
\end{funcdesc}


\begin{funcdesc}{getfirstmatchingheader}{name}
Return a list of lines comprising...
...ny. Return \code{None}
if there is no header matching \var{name}.
\end{funcdesc}


\begin{funcdesc}{getrawheader}{name}
Return a single string consisting of the te...
...nt. Return \code{None} if there is
no header matching \var{name}.
\end{funcdesc}


\begin{funcdesc}{getheader}{name}
Like \code{getrawheader(\var{name})}, but strip leading and trailing
whitespace (but not internal whitespace).
\end{funcdesc}


\begin{funcdesc}{getaddr}{name}
Return a pair (full name, email address) parsed ...
...en <jack@cwi.nl>'} instead, it would yield the
exact same result.
\end{funcdesc}


\begin{funcdesc}{getaddrlist}{name}
This is similar to \code{getaddr(\var{list})...
...correct. It
yields bogus results if a full name contains a comma.
\end{funcdesc}


\begin{funcdesc}{getdate}{name}
Retrieve a header using \code{getheader} and par...
...le that this
function may occasionally yield an incorrect result.
\end{funcdesc}

Message instances also support a read-only mapping interface. In particular: m[name] is the same as m.getheader(name); and len(m), m.has_key(name), m.keys(), m.values() and m.items() act as expected (and consistently).

Finally, Message instances have two public instance variables:


\begin{datadesc}{headers}
A list containing the entire set of header lines, in t...
...
blank line terminating the headers is not contained in the list.
\end{datadesc}


\begin{datadesc}{fp}
The file object passed at instantiation time.
\end{datadesc}