Free Support Forum -

Loading a MailMessage Fails


In Aspose.Email for Java if you try to load a MailMessage via the, method for a message that contains a 0 byte file as an attachment it fails to load with this exception:

class Specified argument was out of the range of valid values.

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



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.


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();
MailMessage msg = MailMessage.load(“attachedMessage.msg”, loadOptions);

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



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.