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

Free Support Forum - aspose.com

Filter messages by Unique ID

Hi


I have recently purchased Aspose.Total for .NET and I am looking are replacing a competitors product with Aspose Email for downloading and processing of emails from Imap servers, however one capability that I cannot seem to find is the ability to search for message by unique ID.

My application is currently engineered to find emails greater that a specified unique ID and process them, is there a way to replicate this criteria using Aspose Email ImapClient or would I need to download the ImapMessageInfo collection and filter from there? In my scenarios, emails stay on the server in the inbox until they are processed therefore I use the unique ID filter on subsequent calls to get messages to get only those messages that have a unique greater than the last processed.

Hope you can help as Aspose Email appears to have better support for saving the MailMessage locally for archive purposes.

Thanks
Trent

Hi Trent,


Thank you for considering Aspose.Email.

Aspose.Email’s ImapClient can retrieve a message from the specified folder using its Unique ID. The following line of code peforms this desired information using the ListMessage method.

ImapMessageInfo msgInfo = client.ListMessage(string UniqueId) ;

At present, there is no such method available that can retrieve a collection of messages having Unique ids greater than a specified unique ID, but you can use the above method to retrieve the messages as per your requirements. Please let us know if we can be of additional help to you in this regard.

Thanks Kashif


I think I can work around this.

From a performance perspective would your recommendation be to get a list of all messages and then filter/ignore those less than the Unique ID I last processed and only fetch messages of those that are greater, or would I be best to call ListMessage (or FetchMessage for that matter) as per your example above based on the last unique id processed?

Additionally, can I assume unique ID will always be numeric, it was a long value with the previous product I have used? How does this differ from sequence number and which of these should be use?

Regards
Trent

Hi Kashif,


In addition to the above, is there a way in which I can pass a MailQuery to ListMessages and at the same time ask that only a maxNumberOfMessages are returned?

Thanks
Hi Trent,

Thanks for writing back to us.

I have analyzed the information and following are my findings:

tcromer:
From a performance perspective would your recommendation be to get a list of all messages and then filter/ignore those less than the Unique ID I last processed and only fetch messages of those that are greater, or would I be best to call ListMessage (or FetchMessage for that
matter) as per your example above based on the last unique idprocessed?

I am afraid that I could not find some performance benchmark against such a scenario. It seems to be a trade-off as in some cases if mailbox is very large but un-read messages are very less, then
ListMessage seems to be better whereas on the other hand if all the messages are un-read then may be getting list of all messages is more suitable method to process these messages. It can be tuned according to the requirements and no set rule can be defined.

tcromer:
Additionally, can I assume unique ID will always be numeric, it was a long value with the previous product I have used? How does this differ from sequence number and which of these should be use?

UniqueID is a numeric value which is remains unique such that if some message is deleted in mailbox, the UniqueID against that message is also deleted from the list and never assigned again to any message. However when a new message is added or a message is deleted from the
mailbox, sequence numbers are reset from 1.

For example there are 5 messages in inbox having sequence number and UniqueIDs as follows:
1,345
2,346
3,347
4,348
5,349

Now message having UniqueID 347 is deleted. Now the Seq No and
UniqueIDs will be as follows:
1,345
2,346
3,348
4,349

It is assumed that in the above scenario, from the beginning of mailbox, 344 messages are already deleted.

tcromer:
In addition to the above, is there a way in which I can pass a MailQuery to ListMessages and at the same time ask that only a maxNumberOfMessages are returned?

Currently this feature is not available. However we will discuss it with the development team and may log it as enhancement in our future versions. Could you please specify exactly how would you like to use this feature of MailQuery in conjunction with the ListMessages? We will look into its possible implementation at our end.

Hi Kashif,


RE: ListMessages

It would seem ListMessages will be the best approach at this stage unless range search of UID can be accommodated by ImapQueryBuilder. Mailbox being processed only contains messages being processed or to be processed. Messages that have been actioned are moved to a subfolder.

RE: Unique ID vs Seq No

Thanks for the detailed explanation, this confirms to me that Unique ID is what I need to continue working with.

RE: MailQuery & maxNumberOfMessages

I would see this as being another overload of the ListMessages method that would take both a MailQuery and maxNumberOfMessages parameter and would return the said number of messages matching the provided MailQuery. I can obviously do this now however I need to first get all messages matching the MailQuery then take only the first x number.

Regards
Trent

Hi Trent,


Thanks for proposing enhancement in the product.

I have logged request for new overload function in ImapClient.ListMessages which takes two arguments simultaneously i.e. MailQuery and MaxNumberOfRecords.

There are many other enhancements and improvements in pipeline so developers will analyze this new feature and will provide their feedback. I will write here on forum as soon as some information is shared by them.

This enhancement is logged in our issue tracking system as NETWORKNET-33621.

The issues you have found earlier (filed as NETWORKNET-33621) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.