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

Free Support Forum - aspose.com

Unable to extract email attachments

Hello,
we are facing an issue with a particular type of mail message which contains a JPG embedded in the body of the mail, because the Aspose.Email components is not able to extract this image neither as attachments neither as linked resource.
In attachments you can find a sample project to reproduce the issue.
Can u please provide your help and tell me if I’m doing something wrong by code or provide me a quickly workaround.
Regards,

Fabio D’Antonio

CheckNoAttachments.zip (3.7 MB)

@deltapro,

I have worked with the sample project shared by you and have been able to observe the issue. An issue with ID EMAILNET-39543 has been created in our issue tracking 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.

Without access to the sample project you’ve provided, it’s difficult to determine the exact cause of the issue and provide a specific solution. However, I can provide some general guidance on how to handle embedded images in email messages using Aspose.Email.

One option to extract embedded images is to use the MailMessage.getLinkedResources() method to get a collection of linked resources in the email message. You can then iterate through the collection and check if any of the resources are of type “image/jpeg” (or the appropriate type for your image) and extract it using the LinkedResource.ContentStream property.

Another option is to use the MailMessage.getAttachments() method to get a collection of attachments in the email message. You can then iterate through the collection and check if any of the attachments are of type “image/jpeg” and extract it using the Attachment.ContentStream property.