Free Support Forum - aspose.com

Loading a MailMessage Fails


#1

In Aspose.Email for Java if you try to load a MailMessage via the com.aspose.email.MailMessage#load(java.lang.String, com.aspose.email.LoadOptions) method for a message that contains a 0 byte file as an attachment it fails to load with this exception:

class com.aspose.email.system.exceptions.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
com.aspose.email.baq.(SourceFile:398)
com.aspose.email.bai.a(SourceFile:1652)
com.aspose.email.bai.d(SourceFile:1999)
com.aspose.email.bai.a(SourceFile:1483)
com.aspose.email.bai.(SourceFile:120)
com.aspose.email.afb.c(SourceFile:290)
com.aspose.email.MailMessage.a(SourceFile:1479)
com.aspose.email.MailMessage.b(SourceFile:1361)
com.aspose.email.MailMessage.load(SourceFile:1309)

I have attached an example file Test Email for 0 byte files attached.zip (25.4 KB)


#2

@mstandfuss,

I have tried loading the MSG file using Aspose.Email for Java 19.2 and have not been able to observe any issue. Can you please try using the suggested version on your end and share with us if there is any incurring issue on your end.


#3

I think I narrowed the issue down more. It is only if we enable the preserveTnefAttachments parameter on the default MsgLoadOptions.

This fails:
MsgLoadOptions loadOptions = new MsgLoadOptions();
loadOptions.setPreserveTnefAttachments(true);
MailMessage msg = MailMessage.load(“attachedMessage.msg”, loadOptions);

This works:
MsgLoadOptions loadOptions = new MsgLoadOptions();
//loadOptions.setPreserveTnefAttachments(true);
MailMessage msg = MailMessage.load(“attachedMessage.msg”, loadOptions);


#4

@mstandfuss,

I have worked with scenario shared by you and have been able to observe the issue. An issue with ID EMAILJAVA-34512 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.