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

Free Support Forum - aspose.com

Question marks appear in the header of MSG file after saving it with Aspose.Email if accented or Asian characters are used

Dear Aspose team,

We run into a problem while trying to save the attached .msg file with Aspose.Email.

If we change the text of the To: field in an e-mail that contains non-ascii characters (Japanese, Chinese characters or Hungarian or German accented characters), then these characters appear as question marks when the saved mail is opened in Outlook.

Zipped MSG file: MailMessage.zip (6.6 KB)
In the attached PDF file, you can find the detailed description of the problem with sample code and screenshots.
PDF file: Explanation.pdf (240.6 KB)

We had a discussion about these files with MS as well https://social.msdn.microsoft.com/Forums/en-US/140bfa2a-996b-4f01-8893-aff05ea38841/why-is-wrong-with-the-encoding-of-the-to-field-in-this-msg-file?forum=outlookdev but they could not really pinpoint the problem.

Could you please take a look at this issue? Our suspicion is that the problem is in the Aspose saving code, as Japanese mails saved from outlook look alright in general.

Best regards,

Gergely Vándor


We have tried to load and change the content of MailMessage provided using Aspose.Email for .NET 18.9.
Initially, we found that if we using MapiMessage.Save() method for saving it then the characters are appeared as question marks. However, if the MailMessage.save() method is used then it works fine, please find code below:

MailMessage eml = MailMessage.Load(@"D:\MailMessage\" + "MailMessage.msg");
eml.To[0].DisplayName = "这是考验";
eml.Save(@"D:\MailMessage\" + "test.msg", SaveOptions.DefaultMsgUnicode);     

Moreover, we have logged an issue under ID “EMAILNET-39131” for further investigation with saving using MapiMessage. You will automatically be informed here once we have more information to share.

@MuzammilKhan Thanks for the confirmation. Unfortunately the workaround through MailMessage is not a solution for us, as there were other problems with that type, that is why we are using MapiMessages.
We will be waiting for your updated version. Thanks in advance.


Thank you for your feedback.
We are working on this issue with MapiMessage and we will update you as soon we have additional information to share.

Hi @MuzammilKhan,

We managed to utilize the workaround based on the MailMessage type that you suggested. We are still waiting for the results of the full regression tests but it seems we eliminated the previously present obstacles that stopped us from using the MailMessage (tons of refactoring and Aspose version updates).

While you are working on the MapiMessage type I would have a question.

Is there a “preferred” type between the Mail and Mapi classes that you recommend that people should use?

Best regards,
Gergely Vándor


It depends on the functionality required by the user so it is important to understand the basic difference between these two classes. So MapiMessage represents an Outlook Message format document that can be parsed. Whereas MailMessage represents an e-mail message. It allows to access message properties, ex. subject, body, sender and recipients addreses, etc. Also it can be sent and delivered by means of supported mail protocols.


To correctly working with non-ASCII characters please use Unicode format at conversions between MailMessage and MapiMessage. By default (without set options) it used ASCII format.
Please use the code sample given below:

MailMessage message = MailMessage.Load(@"D:\" + "MailMessage.msg");

message.To[0].DisplayName = "这是考验";

var msg = MapiMessage.FromMailMessage(message, MapiConversionOptions.UnicodeFormat);
msg.Save(@"D:\test.msg", SaveOptions.DefaultMsgUnicode); 

We hope that this shall resolve your issue. Please feel free to write back to us if additional information is required.