Hi,
I’ve found a way around it but it feels like a bit of a hack…
Hi Bradley,
Thank you for using Aspose.Email.
Your method is also right, but usually from MapiMessage to MailMessage conversion, the following code sample can be used:
Sample Code:
PersonalStorage pst = PersonalStorage.fromFile("Outlook.pst");
FolderInfo folderInfo = pst.getPredefinedFolder(StandardIpmFolder.Inbox);
MessageInfoCollection coll = folderInfo.getContents();
for (int i=0; i<coll.size(); i++)
{
MessageInfo msgInfo = (MessageInfo)coll.get(i);
MapiMessage mapi = pst.extractMessage(msgInfo);
MailMessageInterpretorFactory.getInstance().getIntepretor(mapi.getMessageClass()).interpret(mapi).save("DestFolder//" + i + ".eml", MessageFormat.getEml());
}
Please let us know if we can be of any additional help to you in this regard.
That works perfectly, thanks very much. I was hoping there would be a way to perform the conversion like this.
MailMessageInterpretorFactory
. getInstance ().getIntepretor( mapi.getMessageClass() )
.interpret(mapi).save(“DestFolder//” + i+".eml", MessageFormat. getEml () );
This Code is not working in java.email 18.9, is there any different method to use “MailMessageInterpretorFactory” class.
Please use the code snippet given below to save EML file.
MapiMessage mapi = pst.extractMessage(messageInfo);
mapi.save("DestFolder\\" + i + ".eml", EmlSaveOptions.getDefaultEml());
We hope that this answered you question. Please feel free to reach us if additional information is required.