Aspose.Email for Java 20.5 Release Notes

All Changes

Key Summary Category
EMAILNET-39781 Add support for message threads Feature
EMAILNET-39710 Calendar Item failing to get added in Office365 account calendar Enhancement
EMAILNET-39794 Set Timezone is not visible in MS Outlook 2016 Enhancement
EMAILNET-39806 IEWSClient: Get folder info by path Enhancement
EMAILJAVA-34701 Multipart/related part marked with content-dispotion attachment missing in MailMessage Enhancement
EMAILJAVA-34700 Text wrapping getting disturbed in case of lengthy CC/TO fields in exported PDF Enhancement
EMAILNET-39823 Can’t save MailMessage with default Date Bug
EMAILNET-39705 Meeting opened as appointment in saved PST when viewed in MS Outlook Bug
EMAILNET-39803 Office 365 Recurrence ICS not getting Appended Bug
EMAILNET-39811 Extra symbols are in the message body Bug
EMAILJAVA-34691 Memory issue loading MapiMessage Bug
EMAILNET-39814 Invalid cast exception in constructor Aspose.Email.Clients.Smtp.SmtpClient Bug
EMAILNET-39815 Querymessages not working properly for ListMessages Bug
EMAILNET-39818 MSG to MHTML wrong sent time extracted Bug
EMAILNET-39820 Aspose.Email: there are unclosed tags in the HtmlBody after loading an .msg file Bug
EMAILJAVA-34697 Erroneous meeting end times on recurring meetings Bug
EMAILNET-39816 Parsing Appointment resulting recurrency error rule error Bug

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("", 993, "username", "password", SecurityOptions.SSLImplicit);

try {


   // 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)



       for (String conversationId : conversationIds) {

           // create the necessary search conditions for a thread

           XGMThreadSearchConditions conditions = new XGMThreadSearchConditions();



           // get results

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

           // print the email conversation in hierarchically manner

           printConversaton("", conversation, messages);




} finally {




 * <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());




       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();