Aspose.Email for Java 20.5 Release Notes

All Changes

KeySummaryCategory
EMAILNET-39781Add support for message threadsFeature
EMAILNET-39710Calendar Item failing to get added in Office365 account calendarEnhancement
EMAILNET-39794Set Timezone is not visible in MS Outlook 2016Enhancement
EMAILNET-39806IEWSClient: Get folder info by pathEnhancement
EMAILJAVA-34701Multipart/related part marked with content-dispotion attachment missing in MailMessageEnhancement
EMAILJAVA-34700Text wrapping getting disturbed in case of lengthy CC/TO fields in exported PDFEnhancement
EMAILNET-39823Can’t save MailMessage with default DateBug
EMAILNET-39705Meeting opened as appointment in saved PST when viewed in MS OutlookBug
EMAILNET-39803Office 365 Recurrence ICS not getting AppendedBug
EMAILNET-39811Extra symbols are in the message bodyBug
EMAILJAVA-34691Memory issue loading MapiMessageBug
EMAILNET-39814Invalid cast exception in constructor Aspose.Email.Clients.Smtp.SmtpClientBug
EMAILNET-39815Querymessages not working properly for ListMessagesBug
EMAILNET-39818MSG to MHTML wrong sent time extractedBug
EMAILNET-39820Aspose.Email: there are unclosed tags in the HtmlBody after loading an .msg fileBug
EMAILJAVA-34697Erroneous meeting end times on recurring meetingsBug
EMAILNET-39816Parsing Appointment resulting recurrency error rule errorBug

New features

Email Threading using ImapClient

Email threading is a useful feature that allows to organize emails into conversations in a hierarchical manner. It is possible by grouping all forwards, replies, and reply-all messages related to the same conversation together. Basically, the IMAP protocol may support the THREAD capability defined in RFC-5256. Besides, there is another IMAP extension provided by Gmail and described as X-GM-EXT-1.

We have added a getMessageThreads method for receiving message threads by ImapClient.


 getMessageThreads(BaseSearchConditions conditions)

Also, the following properties have been added to check the extensions available for the current IMAP server.


  boolean getGmExt1Supported // Gets information whether Gmail X-GM-EXT-1 extension is supported

boolean getThreadSupported // Gets information whether THREAD extension is supported

String[] getThreadAlgorithms // Gets supported THREAD algorithms

Note, if you’re working with Gmail, it likely supports X-GM-EXT-1.

The following code samples show the usage of email threading features. Let’s say we need to get the email threads from Gmail.


  ImapClient client = new ImapClient("imap.gmail.com", 993, "username", "password", SecurityOptions.SSLImplicit);

try {

    client.selectFolder(ImapFolderInfo.IN_BOX);

   // get a list of messages that we'll group by conversation

   ImapMessageInfoCollection messages = client.listMessages();

   // make sure the IMAP server supports X-GM-EXT-1 extension

   if (client.getGmExt1Supported()) {

       // gets unique conversationId for our example

       Set<String> conversationIds = new HashSet<String>();

       for (ImapMessageInfo messageInfo : messages) {

           if (messageInfo.getConversationId() != null)

                conversationIds.add(messageInfo.getConversationId());

       }

       for (String conversationId : conversationIds) {

           // create the necessary search conditions for a thread

           XGMThreadSearchConditions conditions = new XGMThreadSearchConditions();

            conditions.setConversationId(conversationId);

            conditions.setUseUId(true);

           // get results

           List<MessageThreadResult> conversation = client.getMessageThreads(conditions);

           // print the email conversation in hierarchically manner

           printConversaton("", conversation, messages);

            System.out.println("--------------------");

       }

   }

} finally {

    client.dispose();

}

/**

 * <p>

 * Prints the email conversation in hierarchically manner

 * </p>

 */

public static void printConversaton(String indent, Iterable<MessageThreadResult> conversation,

    Iterable<ImapMessageInfo> messages) {

   for (MessageThreadResult thread : conversation) {

       for (ImapMessageInfo messageInfo : messages) {

           if (thread.getUniqueId().equals(messageInfo.getUniqueId())) {

                System.out.println(indent + " (" + thread.getUniqueId() + ") " + messageInfo.getSubject());

               break;

           }

       }

       if (thread.getChildMessages().size() != 0) {

            printConversaton(indent += "-", thread.getChildMessages(), messages);

       }

   }

}

The code will slightly change if the IMAP server supports THREAD capability:

  1. Check if the IMAP server supports THREAD extension:

 if (client.getThreadSupported())
  1. Сreate the suitable search conditions for a thread:

 ThreadSearchConditions conditions = new ThreadSearchConditions();

conditions.setAlgorithm(client.getThreadAlgorithms()[0]);

conditions.setUseUId(true);