Free Support Forum -

Embedded Images coming as Attachement


We have a requirement for which we are extracting attachments from a Outlook Mail File (.msg) using a licensed version of Aspose . During extraction we are getting embeded images in msg as attachments which we do not require. Can you please help us in this.


Thank you for inquiry.

Could you please specify which version and platform (.NET/Java) of Aspose.Network are you using? Please also post the sample MSG file for our analysis.


Thank You for your quick reply.

We are using JAVA platform.I have attached the sample EMBEDED IMAGE CHECK.msg , in this file there is an embeded image and one attached document. But while extracting the attachment instead of getting only one attachment HP23092011.pptx i am also getting embeded image image001.jpg as attachment.

Used Code :-


MapiMessage outlookMessageFile = MapiMessage
.fromFile(tempFilePath + fileName);
MapiAttachmentCollection attColl = outlookMessageFile
int index=0
Iterator iter = attColl.iterator();

while (iter.hasNext()) {
MapiAttachment outlookMessageAttachment =;
MapiAttachment attachment = (MapiAttachment) attColl
.get(index); outlookMessageAttachment.getLongFileName());


Thanks for posting the sample file.

Please update your code as follows to detect the embedded and regular attachments.

MapiAttachment attachment = (MapiAttachment) attColl.get(index);
if (attachment.getProperties().contains(0x3712001E) || attachment.getProperties().contains(0x3712001F))
System.out.println("Embedded attachment: " + outlookMessageAttachment.getLongFileName()); outlookMessageAttachment.getLongFileName());
System.out.println("Regular attachment: " + outlookMessageAttachment.getLongFileName()); outlookMessageAttachment.getLongFileName());


This did not work.

I am getting again both actual and embedded attachment in "else" part.

I did not get the API attachment.getProperties().contains instead i used attachment.getProperties().containsValue. We are using Aspose Network 2.0.1-jdk15.jar .Can you please let us know if any change is required.


Please use the latest version of Aspose.Network for Java 2.3 to get this working.