Loading a MailMessage Fails

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.

I have attached an example file Test Email for 0 byte files attached.zip (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.

The issues you have found earlier (filed as EMAILJAVA-34512) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by muhammadahmad

I did not receive an email when this notifier posted to this thread, like I did when @mudassir.fayyaz posted above. Should I be getting those notifications?



Ideally you should be getting notifications on your end. Can you please verify your Spam mails for possibly notifications going there.

Yea nothing in Junk/Spam folders, and when you posted I got a notification email. Attaching that email in case it helps. Free Support Forum - aspose com Aspose Email Product Family Loading a MailMessage Fails.zip (25.8 KB)


We will internally verify on our end why you have failed to receive the notification on your end and will get back to you with feedback.