--- mboxattachments.py 2020-06-02 01:34:19.784170000 +0200 +++ mboxattachments.py 2020-06-02 01:37:16.055170000 +0200 @@ -243,14 +243,19 @@ - def filter_mbox(self, obj): + def filter_mailbox(self, obj): """ Filter a mbox file or mailbox.mbox instance. """ if isinstance(obj, str): if os.path.isfile(obj): obj = mailbox.mbox(obj) + elif os.path.isdir(obj): + obj = mailbox.Maildir(obj) + else + return + for mail in obj: self.filter_mail(mail) - if isinstance(obj, mailbox.mbox): + if isinstance(obj, mailbox.Mailbox): obj.close() def filter_mail(self, mail): @@ -545,7 +550,7 @@ debugging=debugging, SQstart=SQstart) for mbox in args: - filt.filter_mbox(mbox) + filt.filter_mailbox(mbox) print("\n\n%s emails were filtered, %s emails passed, " "\nprocessing of %s emails failed, "