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

Free Support Forum - aspose.com

MailMessage and MapiMessage


I've 2 pieces of code which doesn't output the same value, and I don't understand why ?


var email = MapiMessage.FromFile(file);
var receivedByName = email.TryGetPropertyString(0x0040001F);

var mm = Aspose.Email.Mail.MailMessage.Load(file);
var email = MapiMessage.FromMailMessage(mm);
var receivedByName = email.TryGetPropertyString(0x0040001F);

The 1st one correctly output the name of user which receive the email.
The 2nd doesn't output anything (null)

I've notice this difference because I'm mainly work with MailMessage, and sometime for some specific usage on Msg file I retrieve a Mapi from the mail message and access mapi properties.

Is it a bug ?
I've tested on latest version available on nuget (v6.2.0.0)

Thank you

Hi Fabrice,

Thank you for contacting Aspose Support team.

Can you please share your sample file with us so that we can investigate it further for assisting you?

Here is the msg file

Thank you

Hi Fabrice,

Thank you for sharing the MSG file.

We have analyzed your sample code and the MSG file as well and would like to share with you that it is an expected behavior. The MailMessage API is simple mail implementation that does not message properties for the loaded message file. These lack then when the message is obtained in MapiMessage using MapiMessage.FromMailMessage. Contrary to MailMessage, the MapiMessage object loads complete message properties and thus provide the information against the desired property. Please feel free to share if you have further concern in this regard.


I can indeed understand why it works this way.
But consider that MSG files are an extension of the MailMessage: they contains the same properties (To/From/Cc/Subject/etc) but add all MAPI related stuff.

In this way, your method "MapiMessage.FromMailMessage" should be aware that the given MailMessage was loaded from a file, and load the missing stuff from this file.

Hi Fabrice,

The MailMessage API is used for communication protocols in addition to reading such files from disc and the additional properties information is not populated once the file is read from disc. Thus, it is not possible for MapiMessage to get this information when MapiMessage.FromMailMessage is used. If you want to have the information of Mapi Properties, please use the MapiMessage to load such MSG files.