Lines Matching refs:mailbox
1 :mod:`mailbox` --- Manipulate mailboxes in various formats
4 .. module:: mailbox
10 **Source code:** :source:`Lib/mailbox.py`
19 Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
35 A mailbox, which may be inspected and modified.
54 state of the mailbox. Similarly, when a message is added to a
61 mailbox during iteration is safe and well-defined. Messages added to the
62 mailbox after an iterator is created will not be seen by the
63 iterator. Messages removed from the mailbox before the iterator yields them
71 changed by some other process. The safest mailbox format to use for such
73 concurrent writing. If you're modifying a mailbox, you *must* lock it by
76 message. Failing to lock the mailbox runs the risk of losing messages or
77 corrupting the entire mailbox.
84 Add *message* to the mailbox and return the key that has been assigned to
104 Delete the message corresponding to *key* from the mailbox.
109 behavior of :meth:`discard` may be preferred if the underlying mailbox
216 created them or of the underlying mailbox. More specific documentation
227 Return a count of messages in the mailbox.
232 Delete all messages from the mailbox.
248 message. If the mailbox is empty, raise a :exc:`KeyError` exception. The
257 (*key*, *message*) pairs. Updates the mailbox so that, for each given
260 each *key* must already correspond to a message in the mailbox or else a
278 Acquire an exclusive advisory lock on the mailbox so that other processes
281 mailbox format. You should *always* lock the mailbox before making any
287 Release the lock on the mailbox, if any.
292 Flush the mailbox, unlock it if necessary, and close any open files. For
308 representation. If *create* is ``True``, the mailbox is created if it does not
316 Maildir is a directory-based mailbox format invented for the qmail mail
318 Maildir mailbox are stored in separate files within a common directory
331 supported. Any subdirectory of the main mailbox is considered a folder if
334 mailbox but should not contain other folders. Instead, a logical nesting is
346 import mailbox
347 mailbox.Maildir.colon = '!'
382 Delete temporary files from the mailbox that have not been accessed in the
398 cause corruption of the mailbox unless threads are coordinated to avoid
399 using these methods to manipulate the same mailbox simultaneously.
450 representation. If *create* is ``True``, the mailbox is created if it does not
454 messages in an mbox mailbox are stored in a single file with the beginning of
491 …`"mbox" is a family of several mutually incompatible mailbox formats <https://www.loc.gov/preserva…
507 representation. If *create* is ``True``, the mailbox is created if it does not
510 MH is a directory-based mailbox format invented for the MH Message Handling
511 System, a mail user agent. Each message in an MH mailbox resides in its own
512 file. An MH mailbox may contain other MH mailboxes (called :dfn:`folders`) in
560 Re-define the sequences that exist in the mailbox based upon *sequences*,
567 Rename messages in the mailbox as necessary to eliminate gaps in
592 the mailbox means locking the :file:`.mh_sequences` file and, only for the
622 on the mailbox format.
637 representation. If *create* is ``True``, the mailbox is created if it does not
640 Babyl is a single-file mailbox format used by the Rmail mail user agent
647 Messages in a Babyl mailbox have two sets of headers, original headers and
650 attractive. Each message in a Babyl mailbox also has an accompanying list of
652 message, and a list of all user-defined labels found in the mailbox is kept
661 Return a list of the names of all user-defined labels used in the mailbox.
666 the mailbox rather than consulting the list of labels in the Babyl
667 options section, but the Babyl section is updated whenever the mailbox
681 underlying mailbox but does not save memory compared to a string
713 representation. If *create* is ``True``, the mailbox is created if it does not
716 MMDF is a single-file mailbox format invented for the Multichannel Memorandum
762 :class:`~email.message.Message`. Subclasses of :class:`mailbox.Message` add
763 mailbox-format-specific state and behavior.
776 mailbox that are supported (although presumably the properties are specific
777 to a particular mailbox format). For example, file offsets for single-file
778 mailbox formats and file names for directory-based mailbox formats are not
779 retained, because they are only applicable to the original mailbox. But state
804 the user opens and closes the mailbox, recording that the messages are old
841 mailbox has been accessed, whether or not the message is has been
970 Messages in an mbox mailbox are stored together in a single file. The
1004 message in an mbox mailbox. The leading "From " and the trailing newline
1224 | filed | Copied to another file or mailbox |
1342 As with message in an mbox mailbox, MMDF messages are stored with the
1375 message in an mbox mailbox. The leading "From " and the trailing newline
1488 The following exception classes are defined in the :mod:`mailbox` module:
1498 Raised when a mailbox is expected but is not found, such as when instantiating a
1505 Raised when a mailbox is not empty but is expected to be, such as when deleting
1511 Raised when some mailbox-related condition beyond the control of the program
1528 A simple example of printing the subjects of all messages in a mailbox that seem
1531 import mailbox
1532 for message in mailbox.mbox('~/mbox'):
1537 To copy all mail from a Babyl mailbox to an MH mailbox, converting all of the
1540 import mailbox
1541 destination = mailbox.MH('~/Mail')
1543 for message in mailbox.Babyl('~/RMAIL'):
1544 destination.add(mailbox.MHMessage(message))
1551 due to malformed messages in the mailbox::
1553 import mailbox
1558 boxes = {name: mailbox.mbox('~/email/%s' % name) for name in list_names}
1559 inbox = mailbox.Maildir('~/Maildir', factory=None)
1570 # Get mailbox to use