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

Free Support Forum - aspose.com

Problem retrieving emails

I’m developing an email client for my company, and I’ve received it as explained in the following link: https://docs.aspose.com/display/emailnet/Working+with+Messages+from+IMAP+ Server

Code sample:

using (var imapClient = new ImapClient(contaEmail.ServidorEntrada, contaEmail.PortaEntrada))
	imapClient.Username = contaEmail.Login;
	imapClient.Password = contaEmail.RecuperarSenha();
	var evnt = new ManualResetEvent(false);
	while (true)
		var builder = new ImapQueryBuilder();
		builder.InternalDate.Greater(DataUltimaSincronizacao.ToUniversalTime(), DateComparisonType.ByDateTime);
		var query = builder.GetQuery();
		var pageInfo = imapClient.ListMessagesByPage(ImapFolderInfo.InBox, query, 15);
		var messages = pageInfo.Items.ToList();
		while (!pageInfo.LastPage)
			pageInfo = imapClient.ListMessagesByPage(ImapFolderInfo.InBox, query, pageInfo.NextPage);
		if (messages.Any())
			foreach (var imapMessageInfo in messages)
				var mailMessage = imapClient.FetchMessage(imapMessageInfo.SequenceNumber);
				OnRecebeuEmail(mailMessage, imapMessageInfo.InternalDate, imapMessageInfo.IsRead);

The problem: If I receive an email after the loop has started, it is not retrieved in the ListMessagesByPage, only if I close the thread and start another, which subsequently rebuilds the ImapClient.

I simulated this in version 17.11 and 18.2.

  • This error occurs in both Imap and Pop3.
  • I’m still not using StartMonitoring because I have another bug open with regard to this case.


We are looking into this query and will soon update you here with our findings.


Thank you for your patience. We have tested this issue and observed the problem. It is logged under Id:EMAILNET-38938 in our issue tracking system. We will consider this issue on its turn and provide feedback immediately once ready for sharing.

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