Free Support Forum - aspose.com

Subject Encoding in MapiMessage

Hi,

we have a problem with the encoding in the subject of our saved MapiMessage.
We use following code for create an editable MSG-file:

using (MailMessage mm = new MailMessage())
{
mm.PreferredTextEncoding = Encoding.UTF8;
mm.SubjectEncoding = Encoding.UTF8;
mm.Subject = “Einstellungen für Office 2010”;
mm.IsBodyHtml = true;
mm.BodyEncoding = Encoding.UTF8;
mm.HtmlBody = File.ReadAllText(filepath, Encoding.UTF8);

using (MapiMessage mapiMessage = MapiMessage.FromMailMessage(mm))
{
mapiMessage.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
mapiMessage.Save(“C:\temp\test.msg”);
}
}

The subject looks like the attachment.
What are we doing wrong?

Hi Marc,


Thank you for considering Aspose.Email as part of your solutions.

I was able to reproduce this issue at my end using the latest version of Aspose.Email for .NET 2.6.0 and have logged it in our bug tracking system under issue id: NETWORKNET-33674. Development team will look into it and once we have any information regarding the resolution of this issue, we’ll update you here via this thread.

If you have any other query/inquiry regarding Aspose.Email, please feel free to post to us. We’ll try to assist you further as soon as possible.

Hi Marc,


The encoding of the original MailMessage is UTF-8, thus for correct message fields display the MapiMessage encoding must be Unicode.

Could you please modify following line of code in your sample and let us know your feedback.
using (MapiMessage mapiMessage = MapiMessage.FromMailMessage(mm,OutlookMessageFormat.Unicode))
Please feel free to write us back if you have any other query in this regard.

Hi,

I modify my code with your sample. The subject is now in correct.

Thanks

Hi Marc,

We are glad to know that your issue is resolved. Please feel free to write us back if you have any other query in this regard.