We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ImapClient.ListMessages() raises exception while using MessageId in query

Thanks for your reply.

I’m trying to d this:


and I get this error: “Imap protocol does not support “MessageId” as field name”.

Can I get an email by ID?



I have also observed this issue and have logged it under id: EMAILNET-34932 in our bug tracking system for further investigation by the product team. I shall write here as soon as some feedback is received in this regard. Following sample code is used to re-produce the scenario:

ImapClient client = new ImapClient(“[imap.gmail.com](http://imap.gmail.com/)”, 993, “userid”, “password”);

client.SecurityOptions = SecurityOptions.SSLImplicit;


ImapQueryBuilder builder = new ImapQueryBuilder();

MailQuery qry = builder.MessageId.Equals("<000801d0c955$112345a0$46aa79e0$@gmail.com>");

ImapMessageInfoCollection messages = client.ListMessages(qry);//EXCEPTION RAISED HERE

You may please traverse the entire ImapMessageInfoCollection to compare the required MessageId for retrieving the target message. Currently, there is no other method available for fetching the message using MessageId.


We have further investigated this issue and found that the IMAP protocol doesn’t support searching messages by MessageId. That is why Aspose.Email API can’t provide searching for messages using the message id. You can find a list of allowed search keys here.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan