Attachment in EML file

I have aspose-total java licensed

I am struggling with the following:

I open a .eml file, and all of the embedded images aren’t listed as attachments

When I attach the image, I can find it under mail.getAttachments(), however when embedding it, I don’t see it under the mail.getAttachments()

I I am using aspose-email-3.6.0-java

I have tried it with different eml files, and it is consistently happening.


Code Snippet:
SharedByteArrayInputStream bis =
new SharedByteArrayInputStream(bos.toByteArray());
bis.reset();
MailMessage asposeMail = MailMessage.load(bis);
System.out.println(“ATTACHMENTS:”+asposeMail.getAttachments().size());

I have attached a sample eml file as example.

Hi Ruan,

Thank you for writing to us.

I would like to share with you that the MailMessage class provides the LinkedResource class to access the embedded images contained in a message file as shown in the code sample below.

However, in your provided sample message file, these can not be read by the MailMessage class. This seems to be an issue at Aspose.Email’s end which has been logged as NETWRKJAVA-33333 in our issue tracking system for further investigation by our development team. We will update you here once the fix version is available in this regard.

Sample Code for accessing Embedded Images:

MailMessage eml = MailMessage.load("email.eml");

System.out.println(eml.getLinkedResources().size());

for (int i=0;i<eml.getLinkedResources().size();i++)
{
    LinkedResource lr = (LinkedResource)eml.getLinkedResources().get(i);
    System.out.println(lr.getContentType().getName());
}

Hi Ruan,


As per your request on live support for the status of the ticket, I have checked the progress and would like to share that this issue is planned to be resolved in the upcoming release in the first quarter of Feb 2014. An automatic notification will be sent to you once the resolved issue is tested by QA team and new version is released online.

Hi Ruan,

We have further investigated this issue and would like to share that the inline images reside in the respective alternate view of the message which can be accessed as shown in the code sample below:

Sample Code:

String fileName = "email.eml";
MailMessage msg = MailMessage.load(fileName);

int num = msg.getAlternateViews().get(1).getLinkedResources().size();

System.out.println(num);

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan