blob: 8beab4cd6fe7358b799a04db007c174c1a4212c8 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{mailbox} ---
Fred Drake199b79c1999-02-20 05:04:59 +00002 Read various mailbox formats}
3
Fred Drakeb91e9341998-07-23 17:59:49 +00004\declaremodule{standard}{mailbox}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\modulesynopsis{Read various mailbox formats.}
6
Guido van Rossum39a23cc1997-06-02 21:04:41 +00007
Guido van Rossum39a23cc1997-06-02 21:04:41 +00008This module defines a number of classes that allow easy and uniform
Fred Drake2e495c91998-03-14 06:48:33 +00009access to mail messages in a (\UNIX{}) mailbox.
Guido van Rossum39a23cc1997-06-02 21:04:41 +000010
Fred Drake2e495c91998-03-14 06:48:33 +000011\begin{classdesc}{UnixMailbox}{fp}
Fred Drakec9dc5151998-01-13 19:01:57 +000012Access a classic \UNIX{}-style mailbox, where all messages are contained
Fred Drake6e99adb1998-02-13 22:17:21 +000013in a single file and separated by ``From name time'' lines.
14The file object \var{fp} points to the mailbox file.
Fred Drake2e495c91998-03-14 06:48:33 +000015\end{classdesc}
Guido van Rossum39a23cc1997-06-02 21:04:41 +000016
Fred Drake2e495c91998-03-14 06:48:33 +000017\begin{classdesc}{MmdfMailbox}{fp}
Guido van Rossum39a23cc1997-06-02 21:04:41 +000018Access an MMDF-style mailbox, where all messages are contained
19in a single file and separated by lines consisting of 4 control-A
Fred Drake6e99adb1998-02-13 22:17:21 +000020characters. The file object \var{fp} points to the mailbox file.
Fred Drake2e495c91998-03-14 06:48:33 +000021\end{classdesc}
Guido van Rossum39a23cc1997-06-02 21:04:41 +000022
Fred Drake2e495c91998-03-14 06:48:33 +000023\begin{classdesc}{MHMailbox}{dirname}
Guido van Rossum39a23cc1997-06-02 21:04:41 +000024Access an MH mailbox, a directory with each message in a separate
Fred Drake6e99adb1998-02-13 22:17:21 +000025file with a numeric name.
26The name of the mailbox directory is passed in \var{dirname}.
Fred Drake2e495c91998-03-14 06:48:33 +000027\end{classdesc}
Guido van Rossum39a23cc1997-06-02 21:04:41 +000028
Fred Drake199b79c1999-02-20 05:04:59 +000029\begin{classdesc}{Maildir}{dirname}
30Access a Qmail mail directory. All new and current mail for the
31mailbox specified by \var{dirname} is made available.
32\end{classdesc}
33
34\begin{classdesc}{BabylMailbox}{fp}
35Access a Babyl mailbox, which is similar to an MMDF mailbox. Mail
Fred Drake180b68b1999-02-22 13:45:09 +000036messages start with a line containing only \code{'*** EOOH ***'} and
Fred Drakefab41f11999-02-22 14:26:16 +000037end with a line containing only \code{'\e{}037\e{}014'}.
Fred Drake199b79c1999-02-20 05:04:59 +000038\end{classdesc}
39
40
41\subsection{Mailbox Objects \label{mailbox-objects}}
Guido van Rossum39a23cc1997-06-02 21:04:41 +000042
43All implementations of Mailbox objects have one externally visible
44method:
45
Fred Drake182bd2d1998-04-02 18:50:21 +000046\begin{methoddesc}[mailbox]{next}{}
Fred Drake806a4671999-03-27 05:45:46 +000047Return the next message in the mailbox, as a \class{rfc822.Message}
48object (see the \refmodule{rfc822} module). Depending on the mailbox
49implementation the \var{fp} attribute of this object may be a true
50file object or a class instance simulating a file object, taking care
51of things like message boundaries if multiple mail messages are
Guido van Rossum39a23cc1997-06-02 21:04:41 +000052contained in a single file, etc.
Fred Drake182bd2d1998-04-02 18:50:21 +000053\end{methoddesc}