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

Free Support Forum - aspose.com

How to Identify Embbed Images from Attachment

Dear Support,

When we receive email that have embbed Images outlook was able to recognise them as an embed Image.

But when I look through the mail message, it was identified as an attachment.

Is there some hidden flag to distinct between attachment and embed image ?

Thanks.
Regards Dat.

Hi Dat,


Thank you for your inquiry.

I am assuming that you are using the .NET version of the product. Please find below the sample code to identify regular and in-line/embedded attachments by using the MapiMessage class. To identify the type of attachment, you have to check for MapiProperty PR_ATTACHMENT_FLAGS in the attachment properties.

C#
var message = MapiMessage.FromFile(“est email with embedded images.msg”);
var attachments = message.Attachments;
var count = attachments.Count;
Console.WriteLine("Total attachments " + count);
for (int i = 0; i < attachments.Count; i++)
{
var attachment = attachments[i];
//check if attachments is inline
if (attachment.Properties.Contains(MapiPropertyTag.PR_ATTACHMENT_FLAGS) && attachment.Properties[MapiPropertyTag.PR_ATTACHMENT_FLAGS].GetInt32() == 8)
{
//Inline/embedded attachments
Console.WriteLine(attachment.LongFileName);
}
else
{
//Regular attachments
Console.WriteLine(attachment.LongFileName);
}
}

Please feel free to write back if you have further inquiries.