Can't extract inline images from MailMessage

Hello,

we are using Aspose-Email to parse EML file since last year, while very happy about it we have found an issue, not solved in last tested version (aspose-email 21.2.1).

We are unable to extract inline base64 image from the attached emailaspose_email_fail_01_anon.eml.zip (11.8 KB)

The sample code (clean) is this

MailMessage eml = MailMessage.load("current-mail.eml", new EmlLoadOptions());
eml.getLinkedResources(); //empty
eml.getAttachments(); //empty 

The mail is being read successfully from our previous parser so we guess there is a bug or a missing part since has been sent by an iPhone and correctly read by all email clients.

@emanuele.poggi,
Welcome to our community! Thank you for the issue description. I reproduced the problem and received the same results. I have logged the issue in our tracking system with ID EMAILJAVA-34840 for further investigation. I will keep you informed about any progress.

@emanuele.poggi,
The EML file has two multipart/alternative view parts (TXT and HTML). The HTML view part is multipart/related and contains the linked attachment. If you need to get the attachment from the related part, you can do it as below:

MailMessage eml = MailMessage.load("aspose_email_fail_01_anon.eml", new EmlLoadOptions());
LinkedResourceCollection linkedResources = eml.getLinkedResources(); //empty
AttachmentCollection attachments = eml.getAttachments(); //empty
for (AlternateView alternateView : eml.getAlternateViews()) {
    System.out.println("View (" + alternateView.getContentType() + ") Linked Resources Count is : " + alternateView.getLinkedResources().size());
}

Output:

View (text/plain; charset="utf-8") Linked Resources Count is : 0
View (text/html; charset="utf-8") Linked Resources Count is : 1

More details: Working with Attachments and Embedded Objects
API Reference: getAlternateViews method

Thank you very much, this opened a door! :smiley:

Best regards,
Emanuele