Hi
We use GreenMail mail server in autotests.
Autotest creates email via smtp and checks mailbox via Aspose.Email.Clients.Imap.ImapClient.
If new email appears during performing ImapClient.ListMessages, then ListMessages returns collection of 3 items: 1 for email and 2 fake ImapMessageInfo with empty UniqueId property.
If new email appears before performing ImapClient.ListMessages, all is ok.
We suggest it happens in course of “EXISTS” and “RECENT” words, which mail server return in answer for client request “FETCH 1:*”.
RFC says EXISTS and RECENT words allowed here. So it looks like a bug in Aspose.Email, and ListMessages must return 1 item in this situation.
How we call ListMessages:
var client = new ImapClient();
client.Host = “host”;
client.Port = client.DefaultPort;
client.Username = “username”;
client.Password = “password”;
client.SelectFolder(ImapFolderInfo.InBox);
var messages = client.ListMessages(query: null, 100);
Tested with latest version of Aspose.Email.
TraceLog of GreenMail
...
2023-06-26 11:30:14,238 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| C: AE_1_1_0008 STATUS "Inbox" (MESSAGES RECENT UNSEEN UIDNEXT UIDVALIDITY)\r\n
2023-06-26 11:30:14,238 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: * STATUS "INBOX" (MESSAGES 0 RECENT 0 UIDNEXT 2 UIDVALIDITY 1687779012 UNSEEN 0)\r\n
2023-06-26 11:30:14,238 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: AE_1_1_0008 OK STATUS completed.\r\n
2023-06-26 11:30:14,244 smtp:0.0.0.0:3025<-/192.168.175.36:61560 DEBUG util.LineLoggingBuffer| S: 250 OK\r\n
2023-06-26 11:30:14,293 smtp:0.0.0.0:3025<-/192.168.175.36:61560 DEBUG util.LineLoggingBuffer| C: QUIT\r\n
2023-06-26 11:30:14,294 smtp:0.0.0.0:3025<-/192.168.175.36:61560 DEBUG util.LineLoggingBuffer| S: 221 /172.17.0.4 Service closing transmission channel\r\n
2023-06-26 11:30:14,298 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| C: AE_1_1_0009 FETCH 1:* (UID RFC822.SIZE FLAGS INTERNALDATE ENVELOPE BODY.PEEK[HEADER.FIELDS (MESSAGE-ID List-Unsubscribe)])\r\n
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG commands.FetchCommand| Fetching body part for section specifier HEADER.FIELDS (MESSAGE-ID List-Unsubscribe) and mime message (contentType=multipart/mixed;
boundary=--boundary_2_e0863f10-7d41-41cd-bf65-59aeb94f090f)
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: * 1 FETCH (FLAGS (\Recent) INTERNALDATE "26-Jun-2023 11:30:14 +0000" RFC822.SIZE 267912 ENVELOPE ("Mon, 26 Jun 2023 11:30:14 +000[WRAP]
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: 0 (GMT)" "Test Subject" (("mail_capture_test" NIL "mail_capture_test" "orpi.comp.npo")) (("mail_capture_test" NIL "mail_capture_t[WRAP]
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: est" "orpi.comp.npo")) (("mail_capture_test" NIL "mail_capture_test" "orpi.comp.npo")) (("user_b3d71291dd7842409066410241669c30" [WRAP]
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: NIL "email_b3d71291dd7842409066410241669c30" "green.mail")) NIL NIL NIL NIL) UID 1 BODY[HEADER.FIELDS (MESSAGE-ID List-Unsubscrib[WRAP]
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: e)] {0}\r\n
2023-06-26 11:30:14,299 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: )\r\n
2023-06-26 11:30:14,300 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: * 1 EXISTS\r\n
2023-06-26 11:30:14,300 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: * 1 RECENT\r\n
2023-06-26 11:30:14,300 imap:0.0.0.0:3143<-/192.168.175.36:61561 DEBUG util.LineLoggingBuffer| S: AE_1_1_0009 OK FETCH completed.\r\n