Free Support Forum - aspose.com

MailMessage Unicode problems with embedded messages

Hi there.

I got other issue with Encoding during working with MSG file.

In our scenario we should open ‘.msg’ file make some changes and save it back to ‘.msg’ file.

I attached two .msg files and the results of our code (images and output files).

Input files:

- “#1_common.msg” got it by savin massged in outlook (“Save As” “Outlook Message Format (*.msg)”);

- “#1_unicode.msg” got it by savin massged in outlook (“Save As” “Outlook Message Format – Unicode (*.msg)”);

My code:

AsposeTest3("#1_common.msg");

AsposeTest3("#1_unicode.msg");

private static void AsposeTest3(string name)

{

MailMessage mailMessage;

using (MemoryStream mStream = new MemoryStream(File.ReadAllBytes(name)))

mailMessage = MailMessage.Load(mStream, MessageFormat.Msg);

mailMessage.Save(name + ".AFTER.msg", MessageFormat.Msg);

mailMessage.Save(name + ".AFTER.eml", MessageFormat.Eml);

}


Please see attached emails and images with results.

I use Aspose.Email 2.1.0.0


Best regards,

Alex Shloma


Hi Alex,

Thank you for using Aspose.Email.

LiteraCorp:

Input files:

- “#1_common.msg” got it by savin massged in outlook (“Save As” “Outlook Message Format (*.msg)”);

- “#1_unicode.msg” got it by savin massged in outlook (“Save As” “Outlook Message Format – Unicode (*.msg)”);


I was unable to open both these files in Outlook. Can you please check at your end if these messages open fine at your end with Outlook? I have attached the screenshot of the error here for your reference that I get when trying to open the files using Outlook.

You are right, I can not open them also.

Sorry, I’ve attached wrong emails.

Please see attached archive with valid emails. Sorry for inconvenience.

Best regards,
Alex Shloma

Hi Alex,


Please accept our apology for late reply and we are sorry for any inconvenience caused to you.

We have analyzed the information provided by you and have successfully re-produced the issue. We have passed this information to our development team for further analysis. We will write back to you here as soon as we get some feedback from the developer.

This issue is logged in our Issue Tracking System as NETWORKNET-33473.

Thanks for your patience and understanding in this regard.

The issues you have found earlier (filed as NETWORKNET-33473) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi team. Sorry I didn’t get back to you sooner.

I tested new Aspose.Email build (2.3.0). It works fine on code examples from the previous posts.

But I faced with another string encoding problem. I attached test project to work with. The problem is if I open .EML file, which contains Russian words in subject. As you can see in .EML file subject is in utf-8 encoding (see 1.png).

If I just send previously opened file via Aspose SmtpClient then message comes without changes (all Russian string are shown as expected). But if I add one code (assigns subject to itself), then message comes with an incorrect subject (please see 2.png).


I also tried to save file with different methods and flags (I mean MailMessageSaveType and MessageFormat) and then open it in outlook. Got the same issue. Only with MailMessageSaveType.OutlookMessageFormatUnicode I’ve got acceptable result, but still I cannot achieve the same during sending opened .EML file.

Important

FileCompatibilityMode.PreserveTnefAttachments is needed because of “winmail.data” attachment for outbound messages with appointment (see thread http://www.aspose.com/community/forums/414787/broken-appointment-with-attachments/showthread.aspx#414787).

Complete code:

static void Main(string[] args)

{

SmtpClient _cl = new SmtpClient("host", 2526, "login", "password");

MailMessage _ms = MailMessage.Load("test.eml", FileCompatibilityMode.PreserveTnefAttachments);

_ms.Subject = _ms.Subject;

_cl.Send(_ms);

_ms.Save("test2.eml");

_ms.Save("test2_PreserveTnefAttachments.eml", FileCompatibilityMode.PreserveTnefAttachments);

_ms.Save("test2_EmlFormat.eml", MailMessageSaveType.EmlFormat);

_ms.Save("test2_Eml.eml", MessageFormat.Eml);

_ms.Save("test2_Msg.msg", MessageFormat.Msg);

_ms.Save("test2_OutlookMessageFormat.msg", MailMessageSaveType.OutlookMessageFormat);

_ms.Save("test2_OutlookMessageFormatUnicode.msg", MailMessageSaveType.OutlookMessageFormatUnicode);

}

Also I come up with a few questions:

1. Is there any difference between following methods?

a. _ms.Save("test2_EmlFormat.eml", MailMessageSaveType.EmlFormat);

b. _ms.Save("test2_Eml.eml", MessageFormat.Eml);

2. Is there any difference between following methods?

a. _ms.Save("test2_Msg.msg", MessageFormat.Msg);

b. _ms.Save("test2_OutlookMessageFormat.msg", MailMessageSaveType.OutlookMessageFormat);

Best regards,

Alex Shloma

Hi Alex,


We are sorry for the inconvenience caused to you.

We have used your sample code and have reproduced the issue here successfully. When we send message without overwriting subject, its received fine but if we overwrite the subject and then send the message, its not received properly as subject gets corrupted. I have passed all the information to the development team and will write back here as soon as some feed back is received from the developers.

This issue is logged as NETWORKNET-33527 in our issue tracking system.

LiteraCorp:

Also I come up with a few questions:<o:p></o:p>

1. Is there any difference between following methods?<o:p></o:p>

a. _ms.Save(“test2_EmlFormat.eml”, MailMessageSaveType.EmlFormat);<o:p></o:p>

b. _ms.Save(“test2_Eml.eml”, MessageFormat.Eml);<o:p></o:p>

2. Is there any difference between following methods?<o:p></o:p>

a. _ms.Save(“test2_Msg.msg”, MessageFormat.Msg);<o:p></o:p>

b. _ms.Save(“test2_OutlookMessageFormat.msg”, MailMessageSaveType.OutlookMessageFormat);
Apparently there is no difference in the above mentioned cases but we will confirm it again and inform you soon.

The issues you have found earlier (filed as NETWORKNET-33527) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.