Exporting EML's to PST is Aspose use higher compression


#1

Hello,

I have a query about Aspose.Email.

There is a PST file of approx 5.61 GB. While testing Aspose.Email, I extracted all the mail from it, and then used the raw mail to create a new PST file. All the mail seems to be there, but the size of the newly created file is 2.12 GB.

So my question is why is there a difference in the sizes of the original and the one created afresh. Is there some kind of compression happening here?

Regards,
Antony


#2

@antony.aspose,

Can you please share source file so that we may further investigate to help you out. Also please share what you extracted from PST file Contacts, Calendars, or Tasks.


#3

Hi,

We extracted only the email and the PST file did not contain other types of data. Anyway when 5.6 GB becomes 2.12 GB non-email data would not be so much.

What would you need me to share? We are using python and we have follow example process in your documentation. As i mentioned earlier we were able to successfully extract email from the PST and then make a new PST from the extracted raw email, and the message counts are same - Only the sizes of the PST files are different.

Regards,
Antony


#4

@antony.aspose,

I have observed your comments. I like to inform that we need source file to investigate the issue. Every source file contain different data in it. So i request you to please share source than we will investigate and log issue in our issue tracking system.


#5

Hi,

Please find my source code.

PST2EML.py

import os
import sys
import jpype

class PST2EML:

def __init__(self, dataDir):
    self.dataDir = dataDir
    self.MapiMessage = jpype.JClass("com.aspose.email.MapiMessage")
    self.PersonalStorage = jpype.JClass("com.aspose.email.PersonalStorage")           
    self.FileFormatVersion = jpype.JClass("com.aspose.email.FileFormatVersion")           
    self.SaveOptions = jpype.JClass("com.aspose.email.SaveOptions")
    self.License = jpype.JClass("com.aspose.email.License")
    self.License.setLicense("Aspose.Email.Java.lic")

def main2(self):
    # Create an instance of PersonalStorage
    personalStorage = self.PersonalStorage
    pst = personalStorage.fromFile("test.pst")
    rfolder = pst.rootFolder
    saveOptions= self.SaveOptions
    sfolder = pst.rootFolder.getSubFolders()
    for fldr in sfolder:
        contents = fldr.getContents()
        for i in range(contents.size()):
            msg_info = contents.get(i)
            mapi = pst.extractMessage(msg_info)
            subject = mapi.getSubject()
            mapi.save(str(subject)+".eml", saveOptions.getDefaultEml())

EML2PST.py

import os
import sys
import jpype

class EML2PST:

def __init__(self, dataDir):
    self.dataDir = dataDir
    self.MapiMessage = jpype.JClass("com.aspose.email.MapiMessage")
    self.PersonalStorage = jpype.JClass("com.aspose.email.PersonalStorage")           
    self.MailMessage = jpype.JClass("com.aspose.email.MailMessage")
    self.SaveOptions = jpype.JClass("com.aspose.email.SaveOptions")
    
def main2(self):
    # Create an instance of PersonalStorage
    personalStorage = self.PersonalStorage
    pst = personalStorage.create("restore.pst", 0)
    # Create a folder at root of pst
    pst.getRootFolder().addSubFolder("MailVault")
    # Add message to newly created folder
    mapi_message = self.MapiMessage
    for mail_file in glob.iglob(os.path.join(self.dataDir, "*")):
        eml_file = os.path.basename(mail_file)
        msg_file = os.path.splitext(eml_file)[0]+".msg"
        msg_file_path = os.path.join(self.dataDir, msg_file)
        mailMessage = self.MailMessage
        eml = mailMessage.load(mail_file)
        saveOptions= self.SaveOptions
        eml.save(msg_file_path, saveOptions.getDefaultMsgUnicode())
        pst.getRootFolder().getSubFolder("MailVault").addMessage(mapi_message.fromFile(msg_file_path))
    print "Created PST successfully."

#6

@antony.aspose,

Can you please share source file message file so that we may further investigate to help you out.