We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Mbox search Text

Hello,
I use the this code to filter messages in PST/OST files by keyword:

pst = PersonalStorage.from_file(pstFileName,False)
folderInfo = pst.root_folder
querybuilder = PersonalStorageQueryBuilder()
querybuilder.text.contains(Keyword, True)
messages = folderInfo.get_contents(querybuilder.get_query())

I have two problems that I would appreciate help:

1 - How can I do the same filtering, by keyword, in an mbox file (Google Takeout). To get the messages I’m doing:
reader = MboxrdStorageReader(FileName, False)
eml = reader.read_next_message()

2 - How can I use multiple keywords to filter messages.

Thanks

Hello @slad,

I will look into your questions and answer them soon. Thank you.

Hello @slad,

1 - There is no filtering implemented in mbox as the messages are extracted completely at once and you can implement searching for the required keywords in the message body yourself.

2 - Just add more keywords to the query builder.
The following example searches Keyword1 and Keyword2 together:

querybuilder = PersonalStorageQueryBuilder()
querybuilder.text.contains(Keyword1, True)
querybuilder.text.contains(Keyword2, True)

Thanks.