Not extracting all attachments

Hi,

I am trying to extract attachments from an MSG that I know and have verified has 8 attachments. When I use MailMessage.Load or MapiMessage.FromStream, I only get 3 attachments out. Any help or information about how I can ensure that all attachments are being extracted would be great. Aspose version 17.1.0

Thank you!

BadData.zip (2.6 MB)

@aaron.medina,

Thank you for contacting Aspose support team.

You may please give a try to the following sample code using a valid license. If you don’t use valid license, it will show you 3 attachments only as mentioned here. If we analyze this message, it contains only one attachment which is EML itself. This EML contains attachments and linked resources which can be displayed as follows:

MailMessage mail = MailMessage.Load(@"BadData.msg");
if (mail.Attachments[0].ContentType.MediaType == "message/rfc822")
{
    MemoryStream str = new MemoryStream();
    mail.Attachments[0].Save(str);
    MailMessage mail2 = MailMessage.Load(str);
    Console.WriteLine("ATTACHMENTS");
    foreach(Attachment att in mail2.Attachments)
    {
        Console.WriteLine(att.Name);
    }
    Console.WriteLine("LINKED RESOURCES");
    foreach (var res in mail2.LinkedResources)
    {
        Console.WriteLine(res.ContentType.MediaType + ", " + res.ContentId);
    }
}