aioimaplib icon indicating copy to clipboard operation
aioimaplib copied to clipboard

The example in the README.rst shows a different behaviour from what happens on my system

Open shaoran opened this issue 4 years ago • 1 comments

The example in the README.rs file does this:

res, data = await imap_client.select()
print('there is %s messages INBOX' % data[0])

which would be the same behaviour of imaplib. But when I execute this code I get b'FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\Forwarded $Junk $la' instead of the number of emails. I get a list that looks like this:

[b'FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\Forwarded $Junk $la'
 b'bel4 $label5 $label2 $label3 $label1 Junk $Forwarded $MDNSent NonJunk)',
 b'OK [PERMANENTFLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\Forwar'
 b'ded $Junk $label4 $label5 $label2 $label3 $label1 Junk $Forwarded $MDNSent N'
 b'onJunk \\*)]',
 b'OK [URLMECH INTERNAL]',
 b'4046 EXISTS',
 b'0 RECENT',
 b'OK [UNSEEN 1507]',
 b'OK [UIDVALIDITY 1226754362]',
 b'OK [UIDNEXT 127124]',
 b'[READ-WRITE] SELECT completed']

If I execute a select() with the python built-in imaplib with the same credentials, then I get expected behaviour. I checked different imap servers and this always happens. Why is that?

shaoran avatar Nov 02 '21 12:11 shaoran

hmm data[0] should return b'FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\Forwarded $Junk $label4 $label5 $label2 $label3 $label1 Junk $Forwarded $MDNSent NonJunk)' in your example.

In the API for now the data is a list of response lines : it is thinner than imaplib that is extracting data from the whole response lines.

That said, I agree that the log there is %s message with data[0] is misleading.

bamthomas avatar Dec 30 '21 16:12 bamthomas