MSG format - problems with German "umlaute"

Hi,

I was trying your .net demo in the web and provided a subject “äöü” (nonsense, but full of “umlaute”). The resulting .eml file was fine in Thunderbird, but the .msg file did show a “???” in Outlook. I see a problem with the subject encoding here.

Any suggestions?
Regards

Hi,

Thank you for inquiry.

The demo uses MailMessage.Save(“filename.msg”, MailMessageSaveType.OutlookMessageFormat) and it does not handle such characters.

But, you can use MailMessage.Save(“filename.msg”, MailMessageSaveType.OutlookMessageFormatUnicode) to handle German “umlaute”.

MailMessage message = new MailMessage("from@domain.com", "to@domain.com");
message.Subject = “ä,ö,ü”;
message.HtmlBody = “ä,ö,ü”;
message.Save(“test-unicode.msg”, MailMessageSaveType.OutlookMessageFormatUnicode);

Thanks for the hint. Unfortunately this doesn’t work for me, because I need to save it as MapiMessage in order to produce a draft. MapiMessage.Save doesnt’t have an overload which accepts the MailMessageSaveType


Regards

Hi,

In that case, you may use the overloaded MapiMessage.FromMailMessage() method as below:

MailMessage message = new MailMessage();
message.Subject = “review this email - ä,ö,ü”;
// set other properties

// get the MapiMessage intance
MapiMessage msg = MapiMessage.FromMailMessage(message, OutlookMessageFormat.Unicode);
msg.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
msg.Save(“test.msg”);

Yes, that works. Meanwhile I had another solution, but your's is better. I saved the file as msg first and reopened it as MapiMessage before saving it again.

I'm now having another problem, which prevents me to use Aspose.Network, but I will explain it in another thread.

Thanks for now.