Hello. We use Apsose.Email for extracting .eml files which come to the server for the further processing. We have an .eml file from the customer which seems to be valid, but fails with “Specified argument was out of the range of valid values.” exception at Aspose.Email.MailMessage.Save on assembling it back after the processing. I’ve made some research and found the following:
- Seems that the issue is caused by .msg file, attached to eml. msg extracted from eml using Attachment.Save or via saving Attachment.ContentStream to file can’t be opened in Outlook.
- If open .eml file in Outlook and save the .msg attachment to disk manually (through save as), it seems to be opened in Outlook well.
- In our code, if suspend the mail processing and replace the msg, extracted by Aspose, by msg, saved manually from Outlook, the processing does not fail.
I’ve attached the .eml file causing the issue and the code demonstrating how I try to extract the attachment. Can you please take a look at this issue?
AsposeEmlSample.zip (25.2 KB)
First of all you are using Aspose.Email for .NET 20.2. You may please try using latest Aspose.Email for .NET 20.7 on your end first. Secondly, I have used the sample project shared by you as it is and there is no exception thrown on saving. Please observe the following snapshot for reference. One more thing that when I try to open source and generated files in MS Outlook, I get error for both.
Thanks for your response. I’ve updated Aspose.Email to the latest version and changed the sample code. Now the code shows the example of how we save/replace attachments. I get an exception on email save after changing the attachment contents. Also, I still can’t open the extracted attachment (‘attachment.msg’ in the sample) in Outlook, but I can open the original .eml file (‘test.eml’) in Outlook, save the attachment and then open it.
AsposeEmlSample_2.zip (30.8 KB)
I have created an issue with ID EMAILNET-39905 in our issue tracking system to further investigate and resolve the issue. We will share the feedback with you as soon as the issue will be fixed.
The issues you have found earlier (filed as EMAILNET-39905) have been fixed in this update.
Checked the issue using Aspose.Mail 20.9 and it’s fixed. Thanks!
It’s good to hear that your issue has been fixed.