Attachments is not present in any of MailMessage collections: Attachments and LinkedResources

Attached EML message received from Exchange transport agent. When I read EML using the following code, Attachments collection contains only one element and LinkedResources - 0.


MailMessage.Load(@“lmde00BC.original.eml”, new EmlLoadOptions { });

Message contains 2 images (attached screenshot of OutlookSpy).

Why is it happening? Where is the second attachment?

Thanks,
Alex Shloma


Hi Alex,

Thank you for contacting Aspose support team.

Second attachment is actually part of the alternate view. You may please give a try to the following sample code where it displays name of both the attachments.

MailMessage mail = MailMessage.Load("lmde00BC.original.eml", new EmlLoadOptions {});

foreach(Attachment att in mail.Attachments)
    Console.WriteLine(att.Name);

foreach(AlternateView view in mail.AlternateViews)
{
    foreach(LinkedResource res in view.LinkedResources)
    {
        Console.WriteLine(res.ContentType.Name);
    }
}