How to read mail inbox using IMAP protocol and JavaMail and then use local disk to store mails. There is no documentation of mstor. I try this way but it seems that MStorStore just read local mbox instead of creating and updating it according to the external server passed as params in connect() function. I get error: Folder [Inbox] does not exist.
Session lSession = Session.getDefaultInstance(props);
MStorStore lStore = new MStorStore(lSession , new URLName("mstor:c:/some_path/" + _mailModel.account.login));
lStore.connect(_mailModel.account.imap, _mailModel.account.login, _mailModel.account.password);
Folder lInbox = lStore.getDefaultFolder().getFolder("Inbox");
The questioin is how to create MBox from javax.mail.Store that i could read and update using Mstor.
I don't know if I am answering the right question (or answering a question at all), but, here is a method I wrote in a Scala program that takes an array of javamail Messages (acquired via imap) and writes them to a new mbox file in a directory named "mbox" in the root of my project using MStorStore. The new file is named whatever is passed in the "mboxName" parameter.