Browse our Products

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.

 

Aspose.Email for C++ 24.1

Download  Support Forum 

File Details

  • Downloads:
  • 1
  • File Size:
  • 450.08MB
  • Date Added:
  • 24/1/2024

Description

It contains Aspose.Email for C++ 24.1 release.

File Details

Save Email Messages as HTML with Relative Paths

You can gain more flexibility when exporting emails to HTML format with Aspose.Email for C++ 24.1. This version enables specifying relative paths for embedded resources to ensure emails render correctly regardless of the hosting environment’s file structure. This C++ code example highlights the usage of the newly added HtmlSaveOptions::set_UseRelativePathToResources() property to set the default relative path.

auto msg = MapiMessage::Load(sourceFileName);

auto htmlSaveOptions = System::CreateObject<HtmlSaveOptions>();

htmlSaveOptions->set_ResourceRenderingMode(ResourceRenderingMode::SaveToFile);
htmlSaveOptions->set_UseRelativePathToResources(true);

msg->Save(Path::Combine(u"target.html"), htmlSaveOptions);

Source*

Improved Code Maintainability

With the latest version of the C++ email apps API, developers can leverage the ResourceHtmlRendering event for greater control over resource paths. It allows developers to define custom paths for attachments and other resources within the event handler. The following sample code shows how to use the new addition within your C++ solutions:

auto msg = MapiMessage::Load(sourceFileName);
auto htmlSaveOptions = System::CreateObject<HtmlSaveOptions>();

htmlSaveOptions->set_ResourceRenderingMode(ResourceRenderingMode::SaveToFile);
htmlSaveOptions->set_UseRelativePathToResources(true);

auto handler = [](SharedPtr<Object> o, SharedPtr<ResourceHtmlRenderingEventArgs> args)
{
    if (System::ObjectExt::Is<AttachmentBase>(o))
    {
        auto attachment = System::ExplicitCast<AttachmentBase>(o);
        // Since UseRelativePathToResources = true, you should assign a relative path to the PathToResourceFile property.
        args->set_PathToResourceFile(u"images\\"+ attachment->get_ContentType()->get_Name()) = $@"images\{attachment.ContentType.Name}";
    }
}

htmlSaveOptions->ResourceHtmlRendering.connect(handler);

msg->Save(Path::Combine(u"A Day in the Park.html"), htmlSaveOptions);

Source*

You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting Aspose.Email for C++ 24.1 Release Notes.

 English