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

Free Support Forum - aspose.com

Not preserving format when converting from EML to PST and reverse (Java)

Hello Aspose team,

We have been using Aspose for quite some time and we ran into several issues so we would be grateful if you could help us resolve them.

We have tried the following:

  1. saving the existing EML files in PST format
  2. then reading the emails from PST (once they were converted to EML)

and here are the issues we’ve experienced:

  • reduction of empty spaces in body
  • reduction of empty spaces in subject

here is the code that we are using:


PersonalStorage personalStorage = PersonalStorage.create(LOCATION, 0);
FolderInfo currentFolderInfo = personalStorage.getRootFolder().addSubFolder("archive");
personalStorage = null;
currentFolderInfo = null;

personalStorage = PersonalStorage.fromFile(LOCATION);
currentFolderInfo = personalStorage.getRootFolder().getSubFolder("archive");
for (MessageInfo content : currentFolderInfo.getContents()) {
    final MapiMessage mapiMessage = personalStorage.extractMessage(content.getEntryIdString());
    final MailMessage mailMessage = mapiMessage.toMailMessage(new MailConversionOptions());
    mailMessage.save("generated.eml", EmlSaveOptions.getDefaultEml());

Please check the attached two images where you could see the clear differences.

Could you please get back to us if you have any idea how to overcome this problem?

Thank you!

Screenshot from 2020-07-30 11-06-39.png (419.6 KB)
Screenshot from 2020-07-30 11-08-22.png (128.0 KB)


Can you please try using the latest Aspose.Email for Java 20.6 on your end and in case there is still an issue please share the source EML, generated EML and generated PST file for reference so that we may proceed further with investigation on our end.

Hi @mudassir.fayyaz,

Thanks for quick response.

Same result with the latest Aspose.Email for Java.

Here are the zips with example emails.

sample 2 - bad body.zip (130.8 KB)
sample 1 - bad subject.zip (10.6 KB)


We have added an issue with ID EMAILJAVA-34729 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.