Free Support Forum - aspose.com

Attachment name is not proper in PST

Hi,
I have to convert mbox file into PST. I have a EML with other language name. This name is not show properly in PST.
Please find below sample to demonstrate.

Thank You
Ajinath Kharade

@kharade.a,

Thank you for writing to Aspose support team.

Could you please send us the sample mbox file along with the snapshot showing issue and sample code used for this conversion? It will help us to re-produce issue here and provide assistance accordingly.

1)Code :-:

                       **************************************
                        f_ObjEmlLoadOptions = new EmlLoadOptions(); //EML LOAD OPTION
        				 
        		    f_Objmailmessage = MailMessage.load(f_tmpEmlPath, f_ObjEmlLoadOptions); //LOAD EML INTO 
                       MAILMESSAGE
                     
                       f_mapimessage = MapiMessage.fromMailMessage(f_Objmailmessage,f_mapiConversionOption); 

                       f_FolderInfoObj.addMessage(f_mapimessage); // ADD MESSAGES INTO PST FOLDER

                       ****************************************

2)Snapshot after export in PST :-

Screen Shot 2017-08-01 at 12.04.52 PM.png (187.8 KB)

  1. Sample of EML :- Eml attachment Name Issue.zip (1.1 MB)

@kharade.a,

Thank you for providing sample data. I have tried the scenario using latest version Aspose.Email for Java 17.7.0 but could not observe any issue in the output pst file. You may please test it using latest version and following sample code and provide the feedback.

PersonalStorage pst = PersonalStorage.create("Eml attachment Name Issue_Java.pst", FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.createPredefinedFolder("Inbox", StandardIpmFolder.Inbox);
EmlLoadOptions f_ObjEmlLoadOptions = new EmlLoadOptions(); //EML LOAD OPTION
MailMessage f_Objmailmessage = MailMessage.load("Eml attachment Name Issue.eml", f_ObjEmlLoadOptions); //LOAD EML INTO MAILMESSAGE
MapiMessage f_mapimessage = MapiMessage.fromMailMessage(f_Objmailmessage,MapiConversionOptions.getUnicodeFormat());
f_FolderInfoObj.addMessage(f_mapimessage); // ADD MESSAGES INTO PST FOLDER

Output pst file is attached here for your reference.Output.zip (959.7 KB)

When i try to download you provided Output.zip then this message is comming->Sorry, this file is private. Only visible to topic owner and staff members.

@kharade.a,

We are sorry for the inconvenience caused to you in this regard. Please download the PST file from here. Our teams are looking into this issue for further resolution.

Hello Kashif,

Hello Kashif,
I am using this code while converting mailmessage to mapimessage using aspose.email fo java. I have to maintain embeded attachment as it is. If i not use this then eml attachment is known as msg attachment.

Please help me.

MapiConversionOptions f_mapiConversionOption = new MapiConversionOptions();
f_mapiConversionOption.setPreserveEmbeddedMessageFormat(true);
f_mapimessage = MapiMessage.fromMailMessage(f_Objmailmessage,f_mapiConversionOption);

@kharade.a,

I have tested the PreserveEmbededMessageFormat option using the sample EML provided here. All the EML attachment files are properly maintained and can be opened successfully. Could you please provide us a sample EML file which can be used to re-produce this scenario?

Hello Kashif,
Try to understand my issue. I have to use PreserveEmbededMessageFormat option and MapiConversionOptions.getUnicodeFormat() while converting form mailmessage to mapimessage. Please provide me sample code.

This is original code that you provided here…

MapiMessage f_mapimessage = MapiMessage.fromMailMessage(f_Objmailmessage,MapiConversionOptions.getUnicodeFormat());

@kharade.a,

You can use the MapiConversionOptions object for this purpose as shown in the following code sample. We don’t see any issue in the output PST file generated with this code. If you still face some problem, please share your complete sample code along with a screenshot of the problem for further assistance from our end.

Sample Code

PersonalStorage pst = PersonalStorage.create("160887\\Eml attachment Name Issue_Java.pst", FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.createPredefinedFolder("Inbox", StandardIpmFolder.Inbox);
EmlLoadOptions f_ObjEmlLoadOptions = new EmlLoadOptions(); //EML LOAD OPTION
MailMessage f_Objmailmessage = MailMessage.load("160887\\Eml attachment Name Issue.eml", f_ObjEmlLoadOptions); //LOAD EML INTO MAILMESSAGE

MapiConversionOptions options = new MapiConversionOptions();
options.setPreserveEmbeddedMessageFormat(true);
options.setFormat(OutlookMessageFormat.Unicode);
MapiMessage f_mapimessage = MapiMessage.fromMailMessage(f_Objmailmessage, options);
f_FolderInfoObj.addMessage(f_mapimessage); // ADD MESSAGES INTO PST FOLDER

Hi,
I have to use PreserveEmbededMessageFormat option and MapiConversionOptions.getUnicodeFormat() at same time. Can i use this.

@kharade.a,

You may please use following sample code to achieve the functionality.

PersonalStorage pst = PersonalStorage.create("output.pst", FileFormatVersion.Unicode);
FolderInfo f_FolderInfoObj = pst.createPredefinedFolder("Inbox", StandardIpmFolder.Inbox);
EmlLoadOptions f_ObjEmlLoadOptions = new EmlLoadOptions(); //EML LOAD OPTION
MailMessage f_Objmailmessage = MailMessage.load("attachment Name Issue.eml", f_ObjEmlLoadOptions); //LOAD EML INTO MAILMESSAGE
MapiConversionOptions f_mapiConversionOption = MapiConversionOptions.getUnicodeFormat();
f_mapiConversionOption.setPreserveEmbeddedMessageFormat(true);
MapiMessage f_mapimessage = MapiMessage.fromMailMessage(f_Objmailmessage,f_mapiConversionOption);
f_FolderInfoObj.addMessage(f_mapimessage);