Free Support Forum -

Useless attachments listed after upgrade to Aspose.Email 20.6

Since upgrading from Aspose.Email 19.3 to 20.6 we’ve started to see un-useable attachments being returned for certain emails.

Sample code for extracting attachments:

LoadOptions loadOptions = new EmlLoadOptions();

MapiMessage msg = MapiMessage.load(filename, loadOptions);


msg.getAttachments().forEach( attachment -> {
  // Output escaped attachment name
  System.out.println(String.format("Attachment name: %s", StringEscapeUtils.escapeJava(attachment.getDisplayName())));

 // Let's check the attachment method
 // Documentation:
if(attachMethod == 0x00000000) {
    System.out.println("Attach method: afNone");
} else if(attachMethod == 0x00000001) {
    System.out.println("Attach method: afByValue");
} else if(attachMethod == 0x00000002) {
    System.out.println("Attach method: afByReference");
} else if(attachMethod == 0x00000003) {
    System.out.println("Attach method: afByReference");
} else if(attachMethod == 0x00000004) {
    System.out.println("Attach method: afByReferenceOnly");
} else if(attachMethod == 0x00000005) {
    System.out.println("Attach method: afEmbeddedMessage");
} else if(attachMethod == 0x00000006) {
    System.out.println("Attach method: afStorage");
} else if(attachMethod == 0x00000007) {
    System.out.println("Attach method: afByWebReference");
} else {
    System.out.println(String.format("Invalid attach method: %x - not allowed.", attachMethod));

// How large
System.out.println(String.format("Attachment Size: %s bytes", attachment.getBinaryData().length));

// Save to disk;

When we run this sample email (31.7 KB) we get the following output:

Important Test Meeting 2(Aspose.Email Evaluation)
Attachment name: Unnamed
Attach method: afByValue
Attachment Size: 40 bytes

The resulting Unnamed attachment is useless and doesn’t represent any useful data.

Also as you can see it is not marked as an inline attachment.

If we run the same code using version 19.3 we get the expected output where the useless attachment is being ignored:

Important Test Meeting 2(Aspose.Email Evaluation)


In order to verify the issue further on our end and resolving it, we have created an issue with ID EMAILNET-39895 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.

The issues you have found earlier (filed as EMAILNET-39895) have been fixed in this update.