repoze.mailin provides a framework for mapping inbound e-mail onto application-defined handlers.
repoze.mailin defines an API, IMessageStore, for plugins which store RFC2822-style messages. Plugins can be configured dynamically via an entry point, which makes it possible to plug in a variety of backing stores (e.g., ZODB, a relational database, or something like the Goolge App Engine BigTable).
Within a store, messages are identified via a message_id, derived from the RFC2822 Message-Id header of the message.
repoze.mailin expects to process messages which are parseable using Python’s email.parser package, which creates a message object consisting of the “headers” (as a mapping or sequence), plus the message payload.
repoze.mailin performs no special handling of attachments, including nested RFC2822 messages, within a message. Such attachments can be extracted via the message object.
A given implementation of IMessageStore may be designed for easy integration with a given type of mail delivery. For instance, rezpoe.mailin.maildir.MaildirStore is an implementation of IMessageStore, based on the standard mailbox.Maildir: it is designed to drain delivered messages from the “inbox” into a series of date-stamped folders.
Other implementations might poll IMAP mailboxes, etc., or might plug directly into the processing chain of a given MDA.
As messages are ingested into the store, repoze.mailin records their message IDs into a queue of pending messages. The API for this queue, IPendingQueue, is implemented by a plugin defined via another entry point.
This package requires Python 2.5 or later (Python 2.4’s version of the ‘mailbox’ module and the ‘email’ package are not solid enough for this application).
This package supplies the following plugin implementations:
- repoze.mailin.maildir.MaildirStore
- implements IMessageStore using a standard :term:maildir, as implemented via the :module:`maildir` module in the Python standard library. Ingested messages are stored in date-stamped folders within / under the main in-box; the plugin provides an additional API for moving messages from the in-box into the appropriate sub-folder. The plugin maintains an index of the ingested messages in a sqlite database table.
- repoze.mailin.pending.PendingQueue
- implements IPendingQueue via a sqlite database table.