Save MailMessage to MemoryStream and Retrieve it

Hi, i have a problem and i don't know how can i solve it.

I have an MailMessage object. It has subject like "notificación".Then i save it to MemoryStream in MSG format:

MemoryStream ms = new MemoryStream();

email.Save(ms, MessageFormat.Msg);

After this i retrieve it (in another class throuhg a MemoryStream parameter)

MailMessage mm = MailMessage.Load(ms, MessageFormat.Msg);

MessageBox.Show(mm.Subject);

And subject is "notificaci?n". Why? How can i retrieve the right subject?

Hi Jose,

Please save the message to memory stream in Unicode Outlook Format and it should work fine as you can see in the attached screenshot that resulted as execution of the following code sample:

Code Sample:

MailMessage msg = new MailMessage();
msg.Subject = "notificación";

MemoryStream ms = new MemoryStream();
msg.Save(ms, MailMessageSaveType.OutlookMessageFormatUnicode);

MailMessage msg2 = MailMessage.Load(ms, MessageFormat.Msg);
Console.WriteLine("Message subject is: " + msg2.Subject);

it works fine. Thankyou. :)

i think this works too with EML format.

Hi Jose,


We are glad to know that your issue is resolved. Please feel free to write us here if you have any other query related to Aspose.Email.