Aspose.Email for Java 23.11 Release Notes

All Changes

EMAILNET-40868Add feature to validate messagesFeature
EMAILNET-41221Add MapiMessage.AttachSignature methodFeature
EMAILNET-41220Make the GetAlternateViewContent method of MailMessage case-insensitiveEnhancement
EMAILNET-41229ContentLocation not set when converting EML to MSGBug
EMAILNET-41153Appointment.Save is not thread safeBug
EMAILNET-41216Some MSG file have unexpected characters when open with Aspose MapiMessageBug
EMAILNET-41205Opening the saved email gives the errorBug
EMAILJAVA-35221Error loading task MapiTask.setEstimatedEffort - ArgumentException: The value should be greater than or equal to 0 and less than 0x5AE980DFBug
EMAILJAVA-35220S/MIME signed mail with attachmentsBug

New Features

Validate Email Messages

This functionality allows users to validate message files, ensuring adherence to specified formats and structures. It supports validation for files/streams in the following formats:

  • MIME Formats: eml, emlx, mht
  • MAPI Formats: msg, oft

API members:

MessageValidator.validate Method - validate messages using this method, providing a file path or stream as input.

MessageValidationResult Class - encapsulates the results of the message validation process. Provides insights into the success of the validation, format type, and any encountered errors.

MessageValidationErrorType Enum - Enumerates different types of validation errors.

Code sample:

MessageValidationResult result = MessageValidator.validate(fileName);

// Check if validation is successful
if (!result.isSuccess()) {
    System.out.println("Validation failed.");

    // Check the format type
    if (result.getFormatType() == FileFormatType.Mht) {
        System.out.println("Format type is Mht.");

    // Check and display errors
    System.out.println("Number of errors: " + result.getErrors().size());

    for (MessageValidationError error : result.getErrors()) {
        System.out.println("Error Type: " + error.getErrorType());
        System.out.println("Description: " + error.getDescription());
} else {
    System.out.println("Validation successful.");

Attach signature to email messages

This method, available through the SecureEmailManager class, allows you to attach digital signatures to email messages.

SecureEmailManager.attachSignature Method - facilitates the attachment of digital signatures to email messages. After attaching the signature, verify the results through properties like IsSigned, MessageClass, and attachment details.

You can provide a MailMessage or MapiMessage, a private certificate, and signature options to customize the signature attachment process.

SignatureOptions Class - enables users to specify various options for the signature attachment, including detached or non-detached signatures.

Code sample:

String fileName = "message.msg";
String privateCertFile = "certFile.pfx";
X509Certificate2 privateCert = new X509Certificate2(privateCertFile, "password");

MapiMessage msg = MapiMessage.load(fileName);

SignatureOptions opt = new SignatureOptions();
MapiMessage signedDetached = new SecureEmailManager().attachSignature(msg, privateCert, opt);

if (signedDetached.isSigned()) {
    System.out.println("Detached Signature Attached Successfully.");

MapiMessage signedNonDetached = new SecureEmailManager().attachSignature(msg, privateCert, opt);

if (signedNonDetached.isSigned()) {
    System.out.println("Non-Detached Signature Attached Successfully.");