Aspose.Email for inline images

Dear Aspose Support,

We are trying to extract attachment from an email but we don’t want to consider the inline images as attachment (small icons like facebook, social media icons etc). We are using the code suggested by aspose to differentiate between inline attachment and regular attachments from this link

ExportAttachment.zip (1.5 KB)

I have also attached the stand alone program I used to test this functionality. Please let me know if you need any other information

@Mmustafa

Can you please explain what issue you are facing when you have mentioned your self that Aspose.Email documentation differeniates between extracting inline attachments and regular attachments.

I have attached a sample code in the thread, If I use that code actually its also extracting inline images as attachment, what I am looking is that it should skip inline images and extract only the attachment in the email, thats what I am trying to do.

@Mmustafa

You can please visit this documenation link to observe the difference between inline and regular attachments. I hope the shared information will be helpful.

The link which you shared is for .NET but I have already referred the documentation for Java and used the same code.

But still the code is treating the inline images as regular attachments. I have attached the code used and the file which is used for testing. Please refer the code and the file. I have also added a screenshot in the zip file named as “InlineImageFromEmail.JPG”, those are the images I want to skip as they are inline but these images are still treated as regular attachment. Kindly try to replicate and let me know if you have any questions or suggestions. I hope I have explained clear enough.

@Mmustafa

I have created an issue with ID EMAILJAVA-34769 in our issue trcking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

Thanks. Can this be treated with high priority ? since we are facing this issue in Production .

@Mmustafa

The concerned issue is in progress at the moment and is unresolved. If you want to avail prioritize support for resolution of the issue, then you can avail the paid support option for your convenience.

@Mmustafa

Can you please ensure if you have shared the MSG file having issue as I am unable to find that in attached zip file. This is not generic MSG file issue but an issue with a specific MSG file.

I see the EMAILJAVA-34769 issue is resolved , May I know in which version this issue is resolved ? so that I can apply the fix in our application

@Mmustafa,
Unfortunately, you have not shared the email file for proper investigation of this case. Therefore, the issue was closed. We can continue the investigation further if you provide the email file demonstrating the problem.

Sorry , for the delay in response. I am attaching a sample email here. The mail contains one pdf as attachment and one word document. If we try to export the attachment it also exports the inline images which are present under the mail signaturebll_603170200_4_12083703_20200513115615177.zip (161.7 KB)

@Mmustafa,
Thank you for the email sample. I passed it to our development team. We will continue to investigate this issue.

Hi Andrey, I’m a colleague of @Mmustafa. Did you receive any updates from the development team?
Thanks in advance

@ETerp,
Welcome to our community! Our development team investigated the issue. You should change the isInlineAttachment method. The message is containing the image attachments with assigned ContentId and PidTagAttachFlags = ATT_MHTML_REF but not all images are referenced from HTML body (image002.jpg, 004.jpg, 006.jpg, 008.jpg, 010.jpg, 012.jpg):

else if (msg.getBodyType() == BodyContentType.Html) {
    // check the PidTagAttachFlags property
    if (att.getProperties().containsKey(0x37140003)) {
        long attachFlagsValue = att.getPropertyLong(0x37140003);
        if ((attachFlagsValue & 0x00000004) == 0x00000004) {
            // check PidTagAttachContentId property
            if (att.getProperties().containsKey(MapiPropertyTag.PR_ATTACH_CONTENT_ID)|| att.getProperties().containsKey(MapiPropertyTag.PR_ATTACH_CONTENT_ID_W)) {
// ******************
                /*String contentId = att.getProperties().containsKey(MapiPropertyTag.PR_ATTACH_CONTENT_ID)
                        ? att.getPropertyString(MapiPropertyTag.PR_ATTACH_CONTENT_ID)
                        : att.getPropertyString(MapiPropertyTag.PR_ATTACH_CONTENT_ID_W);
                if (msg.getBodyHtml().contains(contentId)) {
                    return true;
                }*/
// ******************
                return true;
            }