Aspose.Email for CPP 20.7 Release Notes

Aspose.Email for C++ 20.7 is based on Aspose.Email for .NET 20.7.

New Features

Using Timeout for Countering Endless Wait Operations While Saving Message to MHT Format

Sometimes, when processing a corrupted message, an operation may be performed infinitely and thus impair the correct functionality of the application. By using a configurable timeout, you can stop a stuck operation, handle the event, and continue executing the application.

We have added the following members to MhtSaveOptions class:

  • MhtSaveOptions::Timeout - Limits the time in milliseconds of formatting message. The default value is 3000 milliseconds.
  • MhtSaveOptions::TimeoutReached - Raised if timed out while saving to MHTML.

void TimeoutHandler(System::SharedPtr<System::Object> sender, System::SharedPtr<System::EventArgs> ev)
{
  // your event handling here
}

System::String fileName = u"input.msg";
auto mailMessage = MailMessage::Load(fileName);
System::SharedPtr<System::IO::MemoryStream> ms = System::MakeObject<System::IO::MemoryStream>();
System::SharedPtr<MhtSaveOptions> options = SaveOptions::get_DefaultMhtml();
options->TimeoutReached.connect(&TimeoutHandler);
mailMessage->Save(ms, options);