We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Crashes after memory leak on certain emails

Hi, we use Aspose Email and Aspose Word to convert emails to pdfs. We found certain emails cause a memory leak, locks the thread, freezes our application and eventually allocates all the memory on the server.


Emails attached.

Aspose.Email.Mail.MailMessage mailMsg = Aspose.Email.Mail.MailMessage.Load(email, new Aspose.Email.Mail.MhtmlLoadOptions { PrefferedTextEncoding = Encoding.UTF8 });
using (var ms = new MemoryStream())
{
try
{
var mailFormatter = new Aspose.Email.Mail.MhtMessageFormatter();
                <span style="color:blue;">const</span> Aspose.Email.Mail.<span style="color:#2b91af;">MhtFormatOptions</span> mhtFormatOptions = Aspose.Email.Mail.<span style="color:#2b91af;">MhtFormatOptions</span>.HideExtraPrintHeader | Aspose.Email.Mail.<span style="color:#2b91af;">MhtFormatOptions</span>.WriteCompleteEmailAddress;
                mailFormatter.Format(mailMsg, mhtFormatOptions);

                mailMsg.Save(ms);
            }
            <span style="color:blue;">catch</span>(<span style="color:#2b91af;">SystemException</span> ex)
            {
                Logging.Error(<span style="color:#a31515;">"Could not convert email"</span>, ex);
                <span style="color:blue;">throw</span> ex;
            }
		//*********** It fails on this line *******************//
Aspose.Words.Document document = new Aspose.Words.Document(ms, new Aspose.Words.LoadOptions { LoadFormat = Aspose.Words.LoadFormat.Mhtml });
	....

Hi Chris,


Thank you for writing to Aspose Support team.

We have tested both your MSG files at our end and were not able to reproduce the issue using the latest versions of Aspose.Email and Aspose.Words for .NET. We, however, noticed that you are using wrong Load options while loading these MSG files. Please use MsgLoadOptions instead of MhtmlLoadOptions while loading MSG files. Please try it at your end with the latest versions of these APIs and let us know your feedback.

Hi Kashif


Thanks for the reply. The latest version of Aspose.Words clears up the issue. However, our Aspose.Words licence has expired. Is it possible to get an updated licence for the latest version?

Kind Regards

Hi,


In that case, you need to renew your license. Please post your inquiry about renewal in Aspose.Purchase forum to get further information in this regard.