| 
									
										
										
										
											1998-08-10 19:42:37 +00:00
										 |  |  | \section{\module{mailbox} --- | 
					
						
							| 
									
										
										
										
											1999-02-20 05:04:59 +00:00
										 |  |  |          Read various mailbox formats} | 
					
						
							| 
									
										
										
										
											1998-07-23 17:59:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1999-02-20 05:04:59 +00:00
										 |  |  | \declaremodule{standard}{mailbox} | 
					
						
							| 
									
										
										
										
											1998-07-23 17:59:49 +00:00
										 |  |  | \modulesynopsis{Read various mailbox formats.} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | This module defines a number of classes that allow easy and uniform | 
					
						
							| 
									
										
										
										
											1998-03-14 06:48:33 +00:00
										 |  |  | access to mail messages in a (\UNIX{}) mailbox. | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \begin{classdesc}{UnixMailbox}{fp\optional{, factory}} | 
					
						
							|  |  |  | Access to a classic \UNIX{}-style mailbox, where all messages are | 
					
						
							|  |  |  | contained in a single file and separate by ``From '' (a.k.a ``From_'') | 
					
						
							|  |  |  | lines.  The file object \var{fp} points to the mailbox file.  Optional | 
					
						
							|  |  |  | \var{factory} is a callable that should create new message objects. | 
					
						
							|  |  |  | It is called with one argument, \var{fp} by the \method{next()} | 
					
						
							|  |  |  | method.  The default is the \class{rfc822.Message} class (see the | 
					
						
							|  |  |  | \refmodule{rfc822} module). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | For maximum portability, messages in a \UNIX{}-style mailbox are | 
					
						
							|  |  |  | separated by any line that begins exactly with the letters \emph{F}, | 
					
						
							|  |  |  | \emph{r}, \emph{o}, \emph{m}, \emph{[space]} if preceded by exactly two | 
					
						
							|  |  |  | newlines.  Because of the wide-range of variations in practice, | 
					
						
							|  |  |  | nothing else on the From_ line should be considered.  However, the | 
					
						
							|  |  |  | current implementation doesn't check for the leading two newlines. | 
					
						
							|  |  |  | This is usually fine for most applications. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The \class{UnixMailbox} class implements a more strict version of | 
					
						
							|  |  |  | From_ line checking, using a regular expression that usually correctly | 
					
						
							|  |  |  | matched From_ delimiters.  It considers delimiter line to be separated | 
					
						
							|  |  |  | by ``From name time'' lines.  For maximum portability, use the | 
					
						
							|  |  |  | \class{PortableUnixMailbox} class instead.  This | 
					
						
							|  |  |  | class is completely identical to \class{UnixMailbox} except that | 
					
						
							|  |  |  | individual messages are separated by only ``From '' lines. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | For more | 
					
						
							|  |  |  | information see | 
					
						
							|  |  |  | \url{http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html}. | 
					
						
							| 
									
										
										
										
											1998-03-14 06:48:33 +00:00
										 |  |  | \end{classdesc} | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \begin{classdesc}{MmdfMailbox}{fp\optional{, factory}} | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | Access an MMDF-style mailbox, where all messages are contained | 
					
						
							|  |  |  | in a single file and separated by lines consisting of 4 control-A | 
					
						
							| 
									
										
										
										
											1998-02-13 22:17:21 +00:00
										 |  |  | characters.  The file object \var{fp} points to the mailbox file. | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | Optional \var{factory} is as with the \class{UnixMailbox} class. | 
					
						
							| 
									
										
										
										
											1998-03-14 06:48:33 +00:00
										 |  |  | \end{classdesc} | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \begin{classdesc}{MHMailbox}{dirname\optional{, factory}} | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | Access an MH mailbox, a directory with each message in a separate | 
					
						
							| 
									
										
										
										
											1998-02-13 22:17:21 +00:00
										 |  |  | file with a numeric name. | 
					
						
							|  |  |  | The name of the mailbox directory is passed in \var{dirname}. | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \var{factory} is as with the \class{UnixMailbox} class. | 
					
						
							| 
									
										
										
										
											1998-03-14 06:48:33 +00:00
										 |  |  | \end{classdesc} | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \begin{classdesc}{Maildir}{dirname\optional{, factory}} | 
					
						
							| 
									
										
										
										
											1999-02-20 05:04:59 +00:00
										 |  |  | Access a Qmail mail directory.  All new and current mail for the | 
					
						
							|  |  |  | mailbox specified by \var{dirname} is made available. | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \var{factory} is as with the \class{UnixMailbox} class. | 
					
						
							| 
									
										
										
										
											1999-02-20 05:04:59 +00:00
										 |  |  | \end{classdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \begin{classdesc}{BabylMailbox}{fp\optional{, factory}} | 
					
						
							| 
									
										
										
										
											1999-02-20 05:04:59 +00:00
										 |  |  | Access a Babyl mailbox, which is similar to an MMDF mailbox.  Mail | 
					
						
							| 
									
										
										
										
											1999-02-22 13:45:09 +00:00
										 |  |  | messages start with a line containing only \code{'*** EOOH ***'} and | 
					
						
							| 
									
										
										
										
											1999-02-22 14:26:16 +00:00
										 |  |  | end with a line containing only \code{'\e{}037\e{}014'}. | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | \var{factory} is as with the \class{UnixMailbox} class. | 
					
						
							| 
									
										
										
										
											1999-02-20 05:04:59 +00:00
										 |  |  | \end{classdesc} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | \subsection{Mailbox Objects \label{mailbox-objects}} | 
					
						
							| 
									
										
										
										
											1997-06-02 21:04:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | All implementations of Mailbox objects have one externally visible | 
					
						
							|  |  |  | method: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1998-04-02 18:50:21 +00:00
										 |  |  | \begin{methoddesc}[mailbox]{next}{} | 
					
						
							| 
									
										
										
										
											2001-01-31 22:14:01 +00:00
										 |  |  | Return the next message in the mailbox, created with the optional | 
					
						
							|  |  |  | \var{factory} argument passed into the mailbox object's constructor. | 
					
						
							|  |  |  | By defaul this is an \class{rfc822.Message} | 
					
						
							| 
									
										
										
										
											1999-03-27 05:45:46 +00:00
										 |  |  | object (see the \refmodule{rfc822} module).  Depending on the mailbox | 
					
						
							|  |  |  | implementation the \var{fp} attribute of this object may be a true | 
					
						
							|  |  |  | file object or a class instance simulating a file object, taking care | 
					
						
							|  |  |  | of things like message boundaries if multiple mail messages are | 
					
						
							| 
									
										
										
										
											2000-10-10 22:00:03 +00:00
										 |  |  | contained in a single file, etc.  If no more messages are available, | 
					
						
							|  |  |  | this method returns \code{None}. | 
					
						
							| 
									
										
										
										
											1998-04-02 18:50:21 +00:00
										 |  |  | \end{methoddesc} |