1

How do I access messages in the top-level folder of a maildir in Python?

The top-level folder does not show iup in list_folders(), and iterating over the messages gives me messages in all folders, which I don't want.

import mailbox
import os
dirpath = os.path.join(os.environ['HOME'], 'Maildir')
mbox = mailbox.Maildir(dirpath, create=False)

print(mbox.list_folders())    # Top-level folder does not show up
folder = mbox.get_folder(???) # What do I put here?
for msg in folder.itervalues():
    ...
Dietrich Epp
  • 205,541
  • 37
  • 345
  • 415
  • Had you made any progress on this? I'm looking at the module for a slightly different purpose .. – r2evans Nov 29 '18 at 05:31

0 Answers0