• Home
  • Raw
  • Download

Lines Matching refs:mailbox

2 :mod:`mailbox` --- Manipulate mailboxes in various formats
5 .. module:: mailbox
16 Supported mailbox formats are
34 A mailbox, which may be inspected and modified.
53 state of the mailbox. Similarly, when a message is added to a
60 mailbox during iteration is safe and well-defined. Messages added to the
61 mailbox after an iterator is created will not be seen by the
62 iterator. Messages removed from the mailbox before the iterator yields them
70 changed by some other process. The safest mailbox format to use for such
72 concurrent writing. If you're modifying a mailbox, you *must* lock it by
75 message. Failing to lock the mailbox runs the risk of losing messages or
76 corrupting the entire mailbox.
83 Add *message* to the mailbox and return the key that has been assigned to
99 Delete the message corresponding to *key* from the mailbox.
104 behavior of :meth:`discard` may be preferred if the underlying mailbox
194 created them or of the underlying mailbox. More specific documentation
206 Return a count of messages in the mailbox.
211 Delete all messages from the mailbox.
228 message. If the mailbox is empty, raise a :exc:`KeyError` exception. The
237 (*key*, *message*) pairs. Updates the mailbox so that, for each given
240 each *key* must already correspond to a message in the mailbox or else a
258 Acquire an exclusive advisory lock on the mailbox so that other processes
261 mailbox format. You should *always* lock the mailbox before making any
267 Release the lock on the mailbox, if any.
272 Flush the mailbox, unlock it if necessary, and close any open files. For
288 representation. If *create* is ``True``, the mailbox is created if it does not
296 Maildir is a directory-based mailbox format invented for the qmail mail
298 Maildir mailbox are stored in separate files within a common directory
311 supported. Any subdirectory of the main mailbox is considered a folder if
314 mailbox but should not contain other folders. Instead, a logical nesting is
326 import mailbox
327 mailbox.Maildir.colon = '!'
362 Delete temporary files from the mailbox that have not been accessed in the
378 cause corruption of the mailbox unless threads are coordinated to avoid
379 using these methods to manipulate the same mailbox simultaneously.
433 representation. If *create* is ``True``, the mailbox is created if it does not
437 messages in an mbox mailbox are stored in a single file with the beginning of
477 …`"mbox" is a family of several mutually incompatible mailbox formats <https://www.loc.gov/preserva…
493 representation. If *create* is ``True``, the mailbox is created if it does not
496 MH is a directory-based mailbox format invented for the MH Message Handling
497 System, a mail user agent. Each message in an MH mailbox resides in its own
498 file. An MH mailbox may contain other MH mailboxes (called :dfn:`folders`) in
546 Re-define the sequences that exist in the mailbox based upon *sequences*,
553 Rename messages in the mailbox as necessary to eliminate gaps in
578 the mailbox means locking the :file:`.mh_sequences` file and, only for the
608 on the mailbox format.
623 representation. If *create* is ``True``, the mailbox is created if it does not
626 Babyl is a single-file mailbox format used by the Rmail mail user agent
633 Messages in a Babyl mailbox have two sets of headers, original headers and
636 attractive. Each message in a Babyl mailbox also has an accompanying list of
638 message, and a list of all user-defined labels found in the mailbox is kept
647 Return a list of the names of all user-defined labels used in the mailbox.
652 the mailbox rather than consulting the list of labels in the Babyl
653 options section, but the Babyl section is updated whenever the mailbox
667 underlying mailbox but does not save memory compared to a string
699 representation. If *create* is ``True``, the mailbox is created if it does not
702 MMDF is a single-file mailbox format invented for the Multichannel Memorandum
748 :class:`~email.message.Message`. Subclasses of :class:`mailbox.Message` add
749 mailbox-format-specific state and behavior.
760 mailbox that are supported (although presumably the properties are specific
761 to a particular mailbox format). For example, file offsets for single-file
762 mailbox formats and file names for directory-based mailbox formats are not
763 retained, because they are only applicable to the original mailbox. But state
788 the user opens and closes the mailbox, recording that the messages are old
825 mailbox has been accessed, whether or not the message is has been
954 Messages in an mbox mailbox are stored together in a single file. The
988 message in an mbox mailbox. The leading "From " and the trailing newline
1208 | filed | Copied to another file or mailbox |
1326 As with message in an mbox mailbox, MMDF messages are stored with the
1359 message in an mbox mailbox. The leading "From " and the trailing newline
1472 The following exception classes are defined in the :mod:`mailbox` module:
1482 Raised when a mailbox is expected but is not found, such as when instantiating a
1489 Raised when a mailbox is not empty but is expected to be, such as when deleting
1495 Raised when some mailbox-related condition beyond the control of the program
1514 Older versions of the :mod:`mailbox` module do not support modification of
1517 older mailbox classes are still available, but the newer classes should be used
1520 Older mailbox objects support only iteration and provide a single public method:
1525 Return the next message in the mailbox, created with the optional *factory*
1526 argument passed into the mailbox object's constructor. By default this is an
1528 mailbox implementation the *fp* attribute of this object may be a true file
1533 Most of the older mailbox classes have names that differ from the current
1534 mailbox class names, except for :class:`Maildir`. For this reason, the new
1536 slightly from those of the other new mailbox classes.
1538 The older mailbox classes whose names are not the same as their newer
1544 Access to a classic Unix-style mailbox, where all messages are contained in a
1546 *fp* points to the mailbox file. The optional *factory* parameter is a callable
1548 *fp* by the :meth:`!next` method of the mailbox object. The default is the
1557 For maximum portability, messages in a Unix-style mailbox are separated by any
1584 Access an MMDF-style mailbox, where all messages are contained in a single file
1586 *fp* points to the mailbox file. Optional *factory* is as with the
1592 Access an MH mailbox, a directory with each message in a separate file with a
1593 numeric name. The name of the mailbox directory is passed in *dirname*.
1599 Access a Babyl mailbox, which is similar to an MMDF mailbox. In Babyl format,
1605 the visible headers. You'll have to do your own parsing of the mailbox file to
1610 If you wish to use the older mailbox classes with the :mod:`email` module rather
1615 import mailbox
1622 # stop the mailbox iterator
1625 mbox = mailbox.UnixMailbox(fp, msgfactory)
1627 Alternatively, if you know your mailbox contains only well-formed MIME messages,
1631 import mailbox
1633 mbox = mailbox.UnixMailbox(fp, email.message_from_file)
1641 A simple example of printing the subjects of all messages in a mailbox that seem
1644 import mailbox
1645 for message in mailbox.mbox('~/mbox'):
1650 To copy all mail from a Babyl mailbox to an MH mailbox, converting all of the
1653 import mailbox
1654 destination = mailbox.MH('~/Mail')
1656 for message in mailbox.Babyl('~/RMAIL'):
1657 destination.add(mailbox.MHMessage(message))
1664 due to malformed messages in the mailbox::
1666 import mailbox
1671 boxes = dict((name, mailbox.mbox('~/email/%s' % name)) for name in list_names)
1672 inbox = mailbox.Maildir('~/Maildir', factory=None)
1683 # Get mailbox to use