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

Free Support Forum - aspose.com

Unicode support in subject and address fields of MapiMessage- loaded from file

We have got an issue when creating an MapiMessage via MapiMessage.FromFile(“draft.msg”). When we set subject and to addresses with Cyrillic characters, they are not displayed. They are however displayed fine in the body of the email – which in this case is Html. Firstly, we use this technique of creating the MapiMessage from a draft.msg file to avoid “On Behalf Of” appearing next to the senders name once the message has been sent from the user. See this link that suggested the said work around, https://forum.aspose.com/t/41906 . But in using this technique, I don’t see any way of specifying that the subject line and email address fields to being Unicode. What results when we have Russian characters in the Subject line or address fields is square boxes. I see that you can create a MapiMessage using the constructor, new MapiMessage("from@from.com", "to@to.com", "subject", "body", OutlookMessageFormat.Unicode); . As the message is specified as Unicode, the Russian characters appear fine in the Subject and Address fields. But we end up with the “On Behalf Of” problem. So, can you suggest a way for me to work around this problem?


Hi Gareth,

Thank you for your inquiry.

I have studied your scenario and I would suggest you to please give the latest version of Aspose.Email for .NET v1.6.0 a try and feed us back with your results.

In case your problem persists then please provide the sample message having Cyrillic/Russian characters. So I may pass the same to development team for their analysis.


Hi Babar,

Thanks for the quick reply.
I tried the latest version of the Aspose.Email, but alas I still had the same problem.
So just to recap our process. We create our email object as such…

_mapiMsg = MapiMessage.FromFile(_PathName + “Draft.msg”);
to avoid the “On behalf of” being appended to the users sender detail in the email in the sent items folder of outlook. Where draft message is just an empty Outlook message saved to file.

Here is a sample of a subject line where the details are grabbed from the db…
_mapiMsg.Subject = reminder.SubjectLine.ReplaceCaseInsensitive("\[FirstName\]", contactFirstName).ReplaceCaseInsensitive("\[LastName\]", contactLastName);

… and here straight below the above assignment, I do this, and the results are in the attached Capture.png
_mapiMsg.Subject = @“Некоторые русские вещи”;

…If you put a break point after this and interrogate the _mapiMsg.Subject property, you will see “??? ??? ???” instead of the Russian characters. As in the Capture.png file attached.

Hopefully this is enough for your developers to see if they can replicate my problem.

I have added our draft.msg file and also a small screen snap of what I was referring to just above.


Hi Gareth,

Thank you for providing the sample message and further details.

I have worked with your provided sample “draft.msg” and found that Russian characters are converted to ? (question mark) when message subject field is updated, and the message is saved back to disk.

Please try the workaround for your situation as defined ahead. You have mentioned that you are saving a blank message as a draft using the Outlook application. I did the same by selecting “File”|“Save As” and then selected “Outlook Message Format - Unicode” from the “Save as type” list. When I loaded the same message into an instance of MapiMessage, and assigned the subject as “Некоторые русские вещи”, it appeared correctly (please check snapshot attached). I have verified the same for such characters in recipient entries too.

Above solution worked for me. Please try it at your end and feed us back with your results.

Hi Babar,

I had tried that approach earlier of saving the Draft.Msg file as unicode. When doing this I was presented with an error when trying to open the email of “Cannot open item”. I tracked this down to an issue where I was adding the attachment content type as
MapiProperty mapiProperty = new MapiProperty(MapiPropertyTag.PR_ATTACH_CONTENT_ID, Encoding.ASCII.GetBytes(contentID));
instead of …
MapiProperty mapiProperty = new MapiProperty(MapiPropertyTag.PR_ATTACH_CONTENT_ID_W, Encoding.Unicode.GetBytes(contentID));.

I trick for young players!

Thanks for you help.

Hi Gareth,

Thank you for letting us know the workaround for this situation.

Could you please also share the processing code that you are performing on the Draft.msg after loading it?