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

Free Support Forum - aspose.com

MailMessage doesn't have MessageFormat property like MapiMessage

Hi team,
We have 2 options (SaveOptions.DefaultMsg and SaveOptions.DefaultMsgUnicode) in case of saving message to file in .msg format. If we use MapiMessage we can get MessageFormat. But MailMessage doesn’t have property like MessageFormat. Look at the code below please:

            MsgLoadOptions emlLoadOptions = new MsgLoadOptions();
            MailMessage eml = MailMessage.Load(emailFile, emlLoadOptions);
            MapiMessage msg = MapiMessage.FromFile(emailFile);
            var tmp = Path.GetFullPath(emailFile).Replace(Path.GetFileName(emailFile), "");

            eml.Save(tmp + "EmlDefaultMsg.msg", SaveOptions.DefaultMsg);
            eml.Save(tmp + "EmlDefaultMsgUnicode.msg", SaveOptions.DefaultMsgUnicode);

            if (msg.MessageFormat == OutlookMessageFormat.ASCII)
                msg.Save(tmp + "MsgDefaultMsg.msg", SaveOptions.DefaultMsg);
                msg.Save(tmp + "MsgUnicodeMsg.msg", SaveOptions.DefaultMsgUnicode);

The question is how we should understand which options (SaveOptions.DefaultMsg or SaveOptions.DefaultMsgUnicode) we should use in case of MailMessage?



I have observed the requirements shared by you and in order to get more deliberation on this, a ticket with ID EMAILNET-39769 has been created as investigation in our issue tracking system so that we may share notification with you once feedback will be shared.

Could you please clarify what the difference between MailMessage and MapiMessage?
What the main purpose to have these two classes?
In which cases I should use one or the another class?


We have investigated the requirements. Actually, you do not need to focus on the format of the message. You can save the MailMessage and MapiMessage in any of the Unicode or ASCII formats of your choice. If you need a MSG file(or stream) in Unicode format - use SaveOptions.DefaultMsgUnicode and if you need a MSG file(or stream) in ASCII format - use SaveOptions.DefaultMsg.

This applies to both MailMessage and MapiMessage.