Copyright (C) 2000-2012 |
GNU Info (python2.1-lib.info)mailboxRead various mailbox formats ============================ Read various mailbox formats. This module defines a number of classes that allow easy and uniform access to mail messages in a (UNIX) mailbox. `UnixMailbox(fp[, factory])' Access to a classic UNIX-style mailbox, where all messages are contained in a single file and separated by `From ' (a.k.a. `From_') lines. The file object FP points to the mailbox file. The optional FACTORY parameter is a callable that should create new message objects. FACTORY is called with one argument, FP by the `next()' method of the mailbox object. The default is the `rfc822.Message' class (see the `rfc822' module). For maximum portability, messages in a UNIX-style mailbox are separated by any line that begins exactly with the string `'From '' (note the trailing 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 `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 `PortableUnixMailbox' class instead. This class is identical to `UnixMailbox' except that individual messages are separated by only `From ' lines. For more information, see . `PortableUnixMailbox(fp[, factory])' A less-strict version of `UnixMailbox', which considers only the `From ' at the beginning of the line separating messages. The "NAME TIME" portion of the From line is ignored, to protect against some variations that are observed in practice. This works since lines in the message which begin with `'From '' are quoted by mail handling software well before delivery. `MmdfMailbox(fp[, factory])' Access an MMDF-style mailbox, where all messages are contained in a single file and separated by lines consisting of 4 control-A characters. The file object FP points to the mailbox file. Optional FACTORY is as with the `UnixMailbox' class. `MHMailbox(dirname[, factory])' Access an MH mailbox, a directory with each message in a separate file with a numeric name. The name of the mailbox directory is passed in DIRNAME. FACTORY is as with the `UnixMailbox' class. `Maildir(dirname[, factory])' Access a Qmail mail directory. All new and current mail for the mailbox specified by DIRNAME is made available. FACTORY is as with the `UnixMailbox' class. `BabylMailbox(fp[, factory])' Access a Babyl mailbox, which is similar to an MMDF mailbox. In Babyl format, each message has two sets of headers, the _original_ headers and the _visible_ headers. The original headers appear before a a line containing only `'*** EOOH ***'' (End-Of-Original-Headers) and the visible headers appear after the `EOOH' line. Babyl-compliant mail readers will show you only the visible headers, and `BabylMailbox' objects will return messages containing only the visible headers. You'll have to do your own parsing of the mailbox file to get at the original headers. Mail messages start with the EOOH line and end with a line containing only `'\037\014''. FACTORY is as with the `UnixMailbox' class. automatically generated by info2www version 1.2.2.9 |