Browse our Products

Aspose.Email for Java 23.4 Release Notes

All Changes

KeySummaryCategory
EMAILNET-41011Setting properties of ReferenceAttachment on a MapiAttachment objectEnhancement
EMAILNET-41019Add the overloaded IsMultiContacts method with the source file name as a parameterEnhancement
EMAILNET-40665Simplify ics to message conversion APIEnhancement
EMAILNET-41029IPM.Appointment and IPM.AbchPerson to PDFEnhancement
EMAILNET-40960Add HtmlFormatOptions.RenderTaskFields and MhtSaveOptions.SaveAllHeadersEnhancement
EMAILNET-41014GetHtmlBodyText(false) does not work wellBug
EMAILNET-41004OLM File IssueBug
EMAILNET-41036Attachment.SetProperty() adds NamedProperty to MessageBug
EMAILNET-41022Oft to Tnef will return argument out of range exceptionBug
EMAILNET-40999Aspose.Email.Calendar.Appointment.Load() function returns wrong End datetimeBug
EMAILNET-41023Body and attachments are lost when eml added to PstBug
EMAILNET-41016Not able to load .ICS fileBug
EMAILNET-40984Email saved from MBOX not rendered correctlyBug
EMAILNET-41021OlmStorage.GetTotalItemsCount returns more items in some Olm filesBug
EMAILNET-41032EML to MSG conversion issue while using Aspose LicenseBug
EMAILNET-40978Error converting .msg to .emlBug
EMAILNET-41037PST stuck on MapiMessage to MailMessageBug

New Features

Setting ReferenceAttachment on a MapiMessage

We have added a new method that allows users to add a reference attachment in a MapiMessage. When the recipients of the email click on the reference attachment, they will be able to access the linked file if they have the appropriate permissions to do so. By using a reference attachment, you can send a smaller email message and ensure that everyone has access to the most up-to-date version of the file or item.

Our latest API update includes a new method in MapiAttachmentCollection class:

MapiAttachmentCollection.add(String name, String sharedLink, String url, String providerName)

This method has the following parameters:

  • name - the name of attachment
  • sharedLink - a fully qualified shared link to the attachment provided by web service manipulating the attachment
  • url - a file location
  • providerName - a name of reference attachment provider

This example demonstrates how to add a reference attachment to a message.

// Let's say you want to send an email message that includes a link to a Document.pdf file stored on a Google Drive.
// Instead of attaching the document directly to the email message,
// you can create a reference attachment that links to the file on the Google Drive.

// Create a message
MapiMessage msg = new MapiMessage("from@domain.com", "to@domain.com", "Outlook message file",
        "This message is created by Aspose.Email", OutlookMessageFormat.Unicode);

// Add reference attachment
msg.getAttachments().add("Document.pdf",
        "https://drive.google.com/file/d/1HJ-M3F2qq1oRrTZ2GZhUdErJNy2CT3DF/",
        "https://drive.google.com/drive/my-drive",
        "GoogleDrive");
//Also, you can set additional attachment properties
msg.getAttachments().get_Item(0).setProperty(KnownPropertyList.ATTACHMENT_PERMISSION_TYPE, AttachmentPermissionType.AnyoneCanEdit);
msg.getAttachments().get_Item(0).setProperty(KnownPropertyList.ATTACHMENT_ORIGINAL_PERMISSION_TYPE, 0);
msg.getAttachments().get_Item(0).setProperty(KnownPropertyList.ATTACHMENT_IS_FOLDER, false);
msg.getAttachments().get_Item(0).setProperty(KnownPropertyList.ATTACHMENT_PROVIDER_ENDPOINT_URL, "");
msg.getAttachments().get_Item(0).setProperty(KnownPropertyList.ATTACHMENT_PREVIEW_URL, "");
msg.getAttachments().get_Item(0).setProperty(KnownPropertyList.ATTACHMENT_THUMBNAIL_URL, "");
// Finally save the message
msg.save("my.msg");

Adding the overloaded IsMultiContacts method with the file name as a parameter

Changes in public API:

VCardContact.IsMultiContacts(string filePath) - Checks whether source file contains multi contacts.

Code sample:

if (VCardContact.isMultiContacts(fileName))
{
    List<VCardContact> contacts = VCardContact.loadAsMultiple(fileName, Charset.forName("utf-8"));
}

Introducing Simplified ICS to Message Formats Conversion API

We have implemented a new API that simplifies the conversion of calendar ICS format to message formats. With this API, users can easily convert Appointment to message objects such as MapiMessage and MailMessage. The following code example shows how you can easily convert an appointment request into a MailMessage or MapiMessage:

Appointment appointment = Appointment.load("appRequest.ics");

MailMessage eml = appointment.toMailMessage();
MapiMessage msg = appointment.toMapiMessage();

Adding HtmlFormatOptions.RenderTaskFields and MhtSaveOptions.SaveAllHeaders options

Changes in public API:

  • MapiTask.Priority - Gets or sets the current Priority of the Task object.
  • MhtSaveOptions.SaveAllHeaders - Defines whether there is a need to save all headers in output mhtml or not.
  • HtmlFormatOptions.RenderTaskFields - Indicates that the specific Task fields should be written in output html.

Code samples:

MailMessage eml = MailMessage.load("message.eml");
MhtSaveOptions so = SaveOptions.getDefaultMhtml();
so.setSaveAllHeaders(true);
eml.save("message.mhtml", so);
MapiMessage msg = MapiMessage.load("task.msg");
HtmlSaveOptions so = SaveOptions.getDefaultHtml();
so.setHtmlFormatOptions(HtmlFormatOptions.WriteHeader | HtmlFormatOptions.RenderTaskFields);
msg.save("task.html", so);

Set timeout to message conversion and loading process

The timeout feature limits the time in milliseconds while converting and loading messages, ensuring that the process does not take longer than necessary. The TimeoutReached event is raised if the timeout is reached while converting to MailMessage, allowing developers to handle the event appropriately. These features provide developers with more control and customization options, allowing them to optimize their code and improve performance.

Changes in public API:

  • MailConversionOptions.Timeout - Limits the time in milliseconds while converting a message.

  • MailConversionOptions.TimeoutReachedHandler - Raised if the time is out while converting to MailMessage.

  • MsgLoadOptions.Timeout - Limits the time in milliseconds while converting a message.

  • MsgLoadOptions.TimeoutReachedHandler - Raised if the time is out while converting to MailMessage.

Code sample:

MailConversionOptions options = new MailConversionOptions();
// Set the timeout to 5 seconds
options.setTimeout(5000);

options.setTimeoutReachedHandler( new TimeoutReachedHandler() {
    public void invoke(Object sender, EventArgs e) {
        String subj = ((MailMessage)sender).getSubject();
        // Set a flag indicating the timeout was reached
        isTimedOut.set(true);
    }
});

MailMessage mailMessage = mapiMessage.toMailMessage(options);