How can convert both Emlx and Eml to PST.
You can use MailMessage class to load EML/EMLx file and add that to PST file as shown in following code sample.
MailMessage eml = MailMessage.Load("inputfileEML/Emlx"); MapiMessage mapi = MapiMessage.FromMailMessage(eml); PersonalStorage pst = PersonalStorage.Create("somePst.pst", FileFormatVersion.Unicode); FolderInfo fi = pst.CreatePredefinedFolder("test", StandardIpmFolder.Inbox); fi.AddMessage(mapi);
Thanks. Can i convert .emlx multiple parts such as .emlxpart, .partial.emlx file format to pst. This sample code convert only single .emlx file. how can convert .emlxpart, .partial.emlx file to pst.
At present, the API supports EMLx file formats only. Can you please share sample .emlxpart, .partial.emlx sample files with us for further analysis at our end? We’ll look into these for assisting you further.
Emlx File.zip (978.5 KB)
.partial.emlx and .emlxpart file is attached.
Only Emlx files are supported. Emlxpart when opened in Mac OS shows only encoded content and doesn’t open fine. You can thus add Emlx files to PST file. Please let us know if we can be of any additional help to you in this regard.
.emlxpart is completed image(attachment) file which is in the encoded form not a binary file. The .partial.emlx file store the header of .emlxpart file so .emlxpart file is the part of .partial.emlx.
The API loads and adds the .partial.emlx successfully to the PST file. Please try it at your end and let us know if you come across any issue.
It is possible to that the API make the folder hierarchy with emlx and eml format. because the Mail Client which support emlx and eml each folder is store its own emlx and eml file. just a example Inbox folder will be store own emlx and eml file, Sent folder will be store own emlx and eml file, Draft folder will be store own emlx and eml etc. how is possible to add folder Inbox, Sent, Draft in new created pst and can store these folders with their mails contained in eml and emlx file.
You can create any folder structure in PST file using the API. However, direct creation of PST with folder structure from other Mail Client isn’t possible. Please let us know if we can be of any additional help to you with respect to your queries related to the API.
Mail.zip (2.2 MB)
I am uploading the Apple Mail emlx file in a Mail compressed folder.
you can download.
The attached file is the Mail folder which contain the multiple emlx file in multiple directory. how could possible when i select the Mail folder then i want to know the multiple emlx file can convert in new created pst in single attempt.
Can you help us identify the exact MBox file from the attachment? Please note that Aspose.Email API supports MBox file which has all its emails embedded in one single MBox file. Support for such MBox files whose exported eml/emlx files reside outside is not available at the moment.
The attched file store the emlx file not mbox.
you can click Mail folder.
Follow the given path to get the emlx file.
My concern is i want to know how to convert multiple emlx file to new created pst only single attempt from attached file.
If you have multiple emlx files, these first need to be converted to MapiMessage for addition to the PST file. Thus, it is not possible to convert multiple emlx files to new PST with a single attempt.
Mail.zip (2.2 MB)
I am uploading the emlx file in a Mail compressed folder.
The Mail folder store multiple directory such as INBOX, Drafts, Important, All Mail and the each directory store own emlx file the INBOX directory store own emlx file and Drafts store own emlx file and All Mail store own Emlx file etc. i select the root Mail folder which store INBOX, Drafts, Important, All Mail folder emlx file. how could possible i can pass emlx file path one by one in your given sample code.my main concern is how the multiple emlx file one by one converted to MapiMessage for adding to the PST file.
You will have to use your own C# logic to get all the emlx files. You can search for such files in a folder and sub-folder using similar sample code as shown here. This will give you a list of file paths to all the emlx files. Then, you can load the EMLx files into MailMessage one by one and convert these to MapiMessage for adding to PST. I hope this will be helpful to you for achieving what you are looking for.
The uploaded data the Mail folder store multiple directory such as INBOX, Drafts, Important, All Mail and the each directory store own emlx file the INBOX directory store own emlx file and Drafts store own emlx file and All Mail store own emlx file Important store own emlx file. how could possible the INBOX emlx file store in INBOX directory and Drafts emlx file store in Drafts directory and All Mail emlx file store in All Mail directory and Important emlx file store in Important directory in converted PST.basically the main concern is how to create folder hierarchy with e-mail the every directory store own emlx file in converted PST.
Aspose.Email API lets you create folders in PST as per your requirements. You can add Predefined folders like Inbox, Drafts, Sent, etc. For example, the following code sample creates Inbox folder in the PST and adds sample messages to it.
PersonalStorage personalStorage = PersonalStorage.Create(dataDir, FileFormatVersion.Unicode); // Add new folder "Inbox" personalStorage.RootFolder.AddSubFolder("Inbox"); // Select the "Inbox" folder FolderInfo inboxFolder = personalStorage.RootFolder.GetSubFolder("Inbox"); // Add some messages to "Inbox" folder inboxFolder.AddMessage(MapiMessage.FromFile(RunExamples.GetDataDir_Outlook() + "MapiMsgWithPoll.msg"));
Similarly, you can add Sent, Important and other similar folders to the PST and add Emlx files to respective folders in PST using similar code as mentioned above. Please let us know if you need any further assistance in this regard.
Reference: Adding messages to Folders
i select Root Mail folder and add the sub folder Inbox how can add corresponding emlx file for their folder(Inbox) in converted pst. i use your given sample code the end line of sample code not understand.how can pass the path of file with their folder which is converted in pst.
Please modify your code to add EMLx instead of MapiMessage as shared with you in our first reply on this thread. Following code should work for your requirement.
PersonalStorage personalStorage = PersonalStorage.Create(dataDir, FileFormatVersion.Unicode); // Add new folder "Inbox" personalStorage.RootFolder.AddSubFolder("Inbox"); // Select the "Inbox" folder FolderInfo inboxFolder = personalStorage.RootFolder.GetSubFolder("Inbox"); // Add some messages to "Inbox" folder MailMessage emlx = MailMessage.Load("input.emlx"); inboxFolder.AddMessage(MapiMessage.FromMailMessage(emlx));
Basically, MailMessage is your API for reading EML/EMLx files and MapiMessage is the API for adding messages to PST. So, you have to call MapiMessage.FromMailMessage for adding EMLx file to the PST.