Free Support Forum - aspose.com

API hangs on converting MSG to MHTML (C# .NET)

Hello,

The attached MSG file opens in Outlook, but Aspose.Email for .NET 19.6 hangs (i.e. never finishes) when trying to save it as MHTML with the following code:

var mapi = Aspose.Email.Mapi.MapiMessage.FromFile("input.msg");
var msg = mapi.ToMailMessage(new Aspose.Email.Mapi.MailConversionOptions());
var saveOpts = new Aspose.Email.MhtSaveOptions();     
msg.Save("output.mhtml", saveOpts);  // <-- never finishes

input.zip (62.1 KB)

It seems to go into an endless loop. Is it possible to fix this?
Thank you

@ast3,

I have observed the issue shared by you and have created an issue with ID EMAILNET-39519 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.

Hello,

I have seen this with a lot of MSG files recently, so I did some testing with the above test file and found that the issue was introduced in version 19.6. Versions 19.5, 19.4 and 19.3 (didn’t test any lower) process the MSG file correctly, but version 19.6 goes into endless loop.

I could downgrade to 19.5 until this is fixed, but I need 19.6 because it fixes EMAILNET-39502… Can you please advise how long until this regression in 19.6 is fixed?

Thank you!

@ast3,

Thank you for sharing the information. We will consider the information shared while addressing the issue.

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

I have tested the update, and it has fixed thes issue. Thank you!

@ast3,

You are welcome.

We’ve got the same problem with 19.12. Saving a .msg file to .mhtml

It would be a lot better if the Save method could return an error rather than hanging and eating cpu cycles.

@Drammy,

I have observed your requirements and suggest you to please try using latest Aspose.Email for .NET 20.4 on your end and in case there is still an issue then please share the working sample project along with statistics achieved on your end.

Hi Mudassir,

The problem is our support ended in January so the latest we can use is 19.12.

We’re left with an application that simply won’t work and just hangs.

I’ve narrowed the problem down to an HTML alternate view that hangs the MailMessage.Save() method. This is across multiple emails, not just one.

We’ve managed to test it on 20.4 and its fixed, thanks

@Drammy,

It’s good to know that things are fine on your end.

Hello, I am still encountering some MSG files that hang (i.e. never finishes) when saving as MHTML using Aspose.Email for .NET 20.4 using the following code:

var mapi = Aspose.Email.Mapi.MapiMessage.FromFile("input.msg");
var msg = mapi.ToMailMessage(new Aspose.Email.Mapi.MailConversionOptions());
var saveOpts = new Aspose.Email.MhtSaveOptions();     
msg.Save("output.mhtml", saveOpts);  // <-- never finishes

Sample file: input.zip (407.4 KB)

The empty file output.mhtml is created, but it never completes (have left if for 3 hours).

Can you please investigate and fix?

Thanks

@ast3,

I have worked with MSG file shared by you and have been able to observe the issue specified. A ticket with ID EMAILNET-39828 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.

Hi Mudassir,

Issue EMAILNET-39828 is showing as “Status: Closed” - does this mean it is fixed in next update?

Thankyou

@ast3,

I have verified the issue status and like to share that the issue has been marked as resolved in latest Aspose.Email for .NET 20.5. Can you please try using suggested version on your end.

Hi Mudassir,

Aspose.Email for .NET 20.5 has fixed the issue - it now processes the previously slow documents very fast.

Thankyou!

@ast3,

Thank you for your positive feedback.

Hi Mudassir,

On May 4th I raised a similar issue (on this thread) that was fixed. Then this issue was re-reported by, the OP, ast3 11 days ago which appears to be fixed in 20.5.

We’ve also experienced a repeat of the same problem on 20.4.

Is there any chance the code can be altered so that it doesn’t hang our app? Can a timeout be implemented or something? We’re a small company that has spent a lot of money on the aspose.total product and we’re left battling support issues that turn out to be this conversion from MSG to MHTML. We shouldn’t have to manage an isolated app domain just to counter the possibility for Aspose code hanging threads…?

Can something be done other than the sporadic, seemingly temporary fixes?

@Drammy,

The API has been improved internally and there is no code changes for public interface done to improve the performance. If you are having any issue while using latest Aspose.Email for .NET 20.5 API, please feel free to share with us and we will verify that as well. In case, you may please share the source code used, source MSG file and generated MHTML (If any).