Free Support Forum -

Extracted (Attachments or embedded images) documents from EML or MSG files shows increase in file size (Java)

We are using Aspose for extracting attachments from EML & MSG files.
The attachments/embedded images size is not the same as the raw file. After extraction a file is created and this file size not match or a bit more compare to the original file size.


I have observed the issue shared by you and request you to please share the source file along with used sample code along with information which information the API failed to extract on your end.

Below is the code snippet we used:

        MailMessage msg = MailMessage.load(filePath.toString());

        for (int i = 0; i < msg.getAttachments().size(); i++) {
			Attachment attachment = msg.getAttachments().get_Item(i);
            // The above attachment is a file, the size of this file after extraction is not same as the one attached to the parent EML or MSG file.
		for (int i = 0; i < msg.getLinkedResources().size(); i++) {
            LinkedResource linkedResource = msg.getLinkedResources().get_Item(i);
             // The above linkedResource  is a file, the size of this file after extraction is not same as the one attached to the parent EML or MSG file.

EML or MSG files will have some attachments, embedded attachments, once after the extraction these attachments will be save as a file. The file size is increased compare to the file size of a file which is attached.

Note: The target file to be tested is an EML file inside the zip file, i was not able to upload EML file so i zipped the EML file and uploaded the zip file. (32.3 KB)


After processing your files and extracting attachments, I have been able to observe the issue and a ticket with ID EMAILJAVA-34710 has been created to investigate and resolve the issue. We will notify you once issue will be fixed.


We have proceeded further with investigation. The Linked resource image file extracted from Aspsoe.Email is equal to RAW file added in source EML. The file saved from Outlook is not equal to source.

We can check it for "image001.png"

“image001.png” source

Content-Type: image/png;
Content-Transfer-Encoding: base64
Content-ID: image001.png@01D525C4.F2BEDCB0


We can decode BASE64 to file and we can see that the file size is equal to extracted from Aspsoe.Email (501 bytes)