Free Support Forum -

MailMessage has different attachment count from MapiMessage

I have an MSG formatted email message. The message contains several forwarded messages. The body type of the email is HTML.

When I use MapiMessage.FromStream(stream), I have 44 attachments in MapiMessage.Attachments. Using the method described in , I can get 4 non-inline attachments, which are correct.

When I use MailMessage.Load(stream), I have 8 attachments in MailMessage.Attachments, and 36 LinkedResources. Out of the 8 attachments in MailMessage.Attachments, there are 4 files identified as attachment, and the other 4 are inline resources, identified using MapiMessage.

Does it mean we always need to use MapiMessage for MSG files? Or we need to add extra filter to MailMessage.Attachments to get the legitimate attachments from an email message?

In current investigation, Aspose identifies inline resource using ContentId while using MapiMessage. ContentId is from PR_ATTACH_CONTENT_ID_W or PR_ATTACH_CONTENT_ID.

However, Aspose generates random ContentId while using MailMessage.


MapiMessage represents an Outlook Message format document that can be parsed. Whereas MailMessage represents an e-mail message which allows to access message properties, ex. subject, body, sender and recipients addresses, etc. Also it can be sent and delivered by means of supported mail protocols.

Moreover, it is requested to please share sample MSG file so that we could investigate the issue of attachment count difference.