Aspose.Email for Java

Aspose.Email for Java 16.10.0 has been received. Ported from its equivalent .NET version, this month’s release includes the same enhancements as were present in the .NET version of the API. It also improves the API functionality by fixing a number of bugs reported by users. For further information about the enhancements, bug fixes, and public API changes, please visit the release notes section of our documentation.

Enhancements

Listing Messages by Extended Properties using EWS: This month’s release provides enhancement where messages can be retrieved along with extended properties from the Exchange server. The overloaded method of listMessages can be used to specify the extended properties to be fetched from the Exchange server. The following code sample shows an example usage of this new feature of the API.

Retrieving Extra Parameters as Summary Information using IMAP: IMAP protocol supports retrieving information from email servers with custom commands. This month’s release enhances the API functionality to retrieve these extra parameters using the listMessages method of the API. This retrieves the message’s summary information, ImapMessageInfo, along with the specified extra parameters, as shown in the code sample below.

ImapClient client = new ImapClient("host.domain.com", "username", "password");
{
    try
    {
        MailMessage message = new MailMessage(
                "from@domain.com",
                "to@doman.com",
                "EMAILNET-38466 - Retrieve Extra Parameters as Summary Info." ,
                "EMAILNET-38466 Add extra parameters for UID FETCH command");

        //append the message to the server
        String uid = client.appendMessage(message);

        //wait for the message to be appended
        Thread.sleep(5000);

        //Define properties to be fetched from server along with the message
        List messageExtraFields = new List();
        messageExtraFields.add("X-GM-MSGID");
        messageExtraFields.add("X-GM-THRID");
        //retreive the message summary information using it's UID
        ImapMessageInfo messageInfoUID = client.listMessage(uid, messageExtraFields);

        //retreive the message summary information using it's sequence number
        ImapMessageInfo messageInfoSeqNum = client.listMessage(1, messageExtraFields);

        //List messages in general from the server based on the defined properties
        ImapMessageInfoCollection messageInfoCol = client.listMessages(messageExtraFields);

        ImapMessageInfo messageInfoFromList = messageInfoCol.get_Item(0);

        //verify that the parameters are fetched in the summary information

        for (String paramName:messageExtraFields)
        {
            System.out.println(messageInfoFromList.getExtraParameters().containsKey(paramName));

            System.out.println(messageInfoUID.getExtraParameters().containsKey(paramName));

            System.out.println(messageInfoSeqNum.getExtraParameters().containsKey(paramName));
        }
    }
    finally
    {
    }
} 

Other Improvements

This month’s release also contains several bug fixes that were either reported with the .NET version of the API or directly faced with our Java API. Fixing these further adds stability to the API functionality.

API Resources

We have detailed information available online for getting started with the Aspose.Email for Java API. These are: