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

Free Support Forum - aspose.com

Preserving structure and content of .eml

Support staff,


I am handling historical email in .eml format. At the moment I am using a multi-step process to convert the email to .pst. (I also need be able to reverse the process.) This is working but there are problems I will describe later.

The steps I am taking after installing the trial license are:

MailMessage message = MailMessage.load("mail.eml, new EmlLoadOptions());
message.isDraft(false);

PersonalStorage storage = PersonalStorage.create(“out.pst”, 0);
FolderInfo folder = storage.getRootFolder();
options = new MapiConversionOptions();
options.setPreserveOriginalDates(true);
options.setPreserveOriginalAddresses(true);
options.setPreserveSignature(true);
MapiMessage mapiMessage = MapiMessage.fromMailMessage(message, options);
folder.addMessage(mapiMessage);

And similar for reversing the process.

Superficially this works fine but in MailMessage unit testing I found that the headers and content are modified when creating the MailMessage. (It could be modified more in later steps, I am not sure.)
  • Long header lines are wrapped
  • Long content lines are wrapped
  • Double quotes added in some headers
  • Plain text reconstructed from html (not sure about this, saw a url in <> added to plain text)
  • Date: header added when missing
  • Priority: header added
  • Header order changed
  • Mime parts rearranged when mime structure was non-standard
  • Mime borders changed
  • Text encoding changed
I understand that these could be considered cleanups, improvements or conformance to standards but for my application it is essential that the emails are not modified, even at a byte for byte level.

Thank you very much,

Chris

Hi Chris,


Thank you for posting your inquiry.

While converting from EML to MSG for adding it to a PST, there are changes included in the conversion process and certain information is added/altered as per the API requirement. However, this doesn’t have any effect on the output of the process and the messages work fine without any error.