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

Free Support Forum - aspose.com

Unexpected behavior IMAP ListMessages with maxNumberOfMessages, MailQuery (ByDateTime)

Hello,

When I’m trying to list messages using ImapClient (from a Gmail IMAP server) I get some unexpected behavior when supplying a MailQuery with DateComparisonType.ByDateTime and maxNumberOfMessages.

Example:

var queryBuilder = new ImapQueryBuilder();
var date = new DateTime(2022, 1, 12, 16, 0, 0);
var query = queryBuilder.InternalDate.Since(date, DateComparisonType.ByDateTime);

var m1 = await Client.ListMessagesAsync("Inbox", query, 1).ConfigureAwait(false);
// m1.Count == 0
var m2 = await Client.ListMessagesAsync("Inbox", query, 10).ConfigureAwait(false);
// m2.Count == 0
var m3 = await Client.ListMessagesAsync("Inbox", query, 50).ConfigureAwait(false);
// m3.Count == 0
var m4 = await Client.ListMessagesAsync("Inbox", query, 100).ConfigureAwait(false);
// m4.Count == 0
var m5 = await Client.ListMessagesAsync("Inbox", query, 200).ConfigureAwait(false);
// m5.Count == 67
var m6 = await Client.ListMessagesAsync("Inbox", query, 1000).ConfigureAwait(false);
// m6.Count == 532

Am I doing something wrong or is the maxNumberOfMessages parameter not working when building a query with DateComparisonType.ByDateTime? When I change the DateComparisonType to ByDate everything seems to work.

Could someone take a look at this issue?

Thanks

@wboekee

Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. We will investigate the issue and provide you more information on it. Thanks for your cooperation.