|dirname[, factory=rfc822.Message[, create=True]])|
None, MaildirMessage is used as the default message representation. If create is
True, the mailbox is created if it does not exist.
It is for historical reasons that factory defaults to
rfc822.Message and that dirname is named as such rather than
path. For a Maildir instance that behaves like instances of other
Mailbox subclasses, set factory to
Maildir is a directory-based mailbox format invented for the qmail mail transfer agent and now widely supported by other programs. Messages in a Maildir mailbox are stored in separate files within a common directory structure. This design allows Maildir mailboxes to be accessed and modified by multiple unrelated programs without data corruption, so file locking is unnecessary.
Maildir mailboxes contain three subdirectories, namely: tmp, new, and cur. Messages are created momentarily in the tmp subdirectory and then moved to the new subdirectory to finalize delivery. A mail user agent may subsequently move the message to the cur subdirectory and store information about the state of the message in a special "info" section appended to its file name.
Folders of the style introduced by the Courier mail transfer agent are also supported. Any subdirectory of the main mailbox is considered a folder if "." is the first character in its name. Folder names are represented by Maildir without the leading ".". Each folder is itself a Maildir mailbox but should not contain other folders. Instead, a logical nesting is indicated using "." to delimit levels, e.g., "Archived.2005.07".
import mailbox mailbox.Maildir.colon = '!'
Maildir instances have all of the methods of Mailbox in addition to the following:
Some Mailbox methods implemented by Maildir deserve special remarks:
See About this document... for information on suggesting changes.