Get mail files by tag programmatically


I need to train my SpamAssassin (Bayes filter) regularly. I need to be able to identify spam and non-spam RFC822 files in the file system for that. How can I achieve that with Mailpile?

In order to understand the file layout better, I have the following questions:

  1. Is my observation correct that the “cur” directory in Mailpile’s Maildir layout is always empty, and everything is stored in “new”?
  2. In the “mail/” directory, I see “tmp”, “new”, and “cur”, the typical Maildir layout. However, all mail is in the additional directory “8f39b”, which contains a Maildir itself. Why is this?
  3. A given mail is stored in three files: “XXXXX”, “XXXXX8”, and “XXXXX8e”. All three files contain the same data. Why is this?

The important question is, of course:

  1. How to I get (via the API, the CLI, the Python library or some index files) the file names of all messages tagged as “spam” and all messages that do not have this tag?

Thank you!