[![][1]. This month’s release includes a new feature of adding custom flag to a message using IMAP. It also enhances several API functionality by adding to the existing features of the API and fixes bugs. For a detail note on what is new and fixed, please visit the [release notes][2] section of Aspose.Email for Java 17.6.

New Features and Enhancements

Adding Custom Flag to Messages using IMAP: This month’s release provides the capability to add [custom flag to a message][3] using the API’s ImapClient. Custom flags can be added to a message using the addMessageFlags method using the ImageMessageFlags as shown in the following code sample.

// Create a message
MailMessage message = new MailMessage("user@domain1.com", "user@domain2.com", "subject", "message");

ImapClient client = new ImapClient("host.domain.com", 587, "username", "password");
//Append the message to mailbox
String uid = client.appendMessage(ImapFolderInfo.IN_BOX, message);

//Add custom flags to the added message
client.addMessageFlags(uid, ImapMessageFlags.op_BitwiseOr(

//Retrieve the messages for checking the presence of custom flag

ImapMessageInfoCollection messageInfos = client.listMessages();
for (ImapMessageInfo inf: messageInfos)
    ImapMessageFlags[] flags = inf.getFlags().split();

    if (inf.containsKeyword("custom1"))
        System.out.println("Keyword found");

Filtering messages based on Custom Flag: The API also now supports filtering messages based on custom flags from the message. The ImapQueryBuilder can be used to achieve this as shown in the following code sample.

ImapQueryBuilder queryBuilder = new ImapQueryBuilder();



Skipping Inline Images during Email Conversion to MHT: We have also incorporated the functionality of [skipping inline images][4] from email messages while converting to MHTML format. This helps in improved performance while converting email messages that have large size inline images in message body.

MailMessage eml = MailMessage.load(dataDir + "Message.msg", new MsgLoadOptions());
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();

eml.save(dataDir + "EmlToMhtmlWithoutInlineImages_out.mht", mhtSaveOptions); 

API Resources

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

  • [Product Documentation][5] – Provides detailed examples of working with the API
  • [API Reference Guide][6] – Details all the packages and classes of the API
  • [GitHub Examples][7] – Provides ready to run API examples
  • [Aspose.Email Forum][8] – Feel free to contact us on Aspose.Email forum for your queries

[1]: http://blog.aspose.com/wp-content/uploads/sites/2/2016/11/aspose-Email-for-Java_100.png)](https://www.aspose.com/products/email/java)We are pleased to announce the release of [Aspose.Email for Java 17.6](https://downloads.aspose.com/email/java [2]: https://docs.aspose.com/display/emailjava/Aspose.Email+for+Java+17.6+Release+Notes [3]: https://docs.aspose.com/display/emailjava/Aspose.Email+for+Java+17.6+Release+Notes [4]: https://docs.aspose.com/display/emailjava/Loading+and+Saving+Message#LoadingandSavingMessage-ExportingEmailtoMHTwithoutInlineImages [5]: https://docs.aspose.com/display/emailjava/Home [6]: http://www.aspose.com/api/java/email [7]: https://github.com/aspose-email/Aspose.Email-for-Java [8]: https://forum.aspose.com/c/email