IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
7.3.1.2 mbox


7.3.1.2 mbox

class mbox( path[, factory=None[, create=True]])
A subclass of Mailbox for mailboxes in mbox format. Parameter factory is a callable object that accepts a file-like message representation (which behaves as if opened in binary mode) and returns a custom representation. If factory is None, mboxMessage is used as the default message representation. If create is True, the mailbox is created if it does not exist.

The mbox format is the classic format for storing mail on Unix systems. All messages in an mbox mailbox are stored in a single file with the beginning of each message indicated by a line whose first five characters are "From ".

Several variations of the mbox format exist to address perceived shortcomings in the original. In the interest of compatibility, mbox implements the original format, which is sometimes referred to as mboxo. This means that the Content-Length: header, if present, is ignored and that any occurrences of "From " at the beginning of a line in a message body are transformed to ">From " when storing the message, although occurences of ">From " are not transformed to "From " when reading the message.

Some Mailbox methods implemented by mbox deserve special remarks:

get_file( key)
Using the file after calling flush() or close() on the mbox instance may yield unpredictable results or raise an exception.

lock( )
unlock( )
Three locking mechanisms are used--dot locking and, if available, the flock() and lockf() system calls.

See Also:

mbox man page from qmail
A specification of the format and its variations.
mbox man page from tin
Another specification of the format, with details on locking.
Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad
An argument for using the original mbox format rather than a variation.
"mbox" is a family of several mutually incompatible mailbox formats
A history of mbox variations.

See About this document... for information on suggesting changes.