martinrusev / imbox

Python IMAP for Human beings
MIT License
1.18k stars 190 forks source link

Fix ignored headers + unnecessary major version check #206

Closed AT0myks closed 3 years ago

AT0myks commented 3 years ago

I was wondering why Outlook emails didn't have any flags. Turns out data[1] seems to contain the end of data[0][0]. For the 3 other servers I have tested, data[1] is just a single closing parenthesis but in the case of Outlook it contains the flags. Here's the an example of the output of

print(data[0][0])
print(data[1])

for Gmail:

b'1 (UID 9854 FLAGS (\\Seen) BODY[] {25498}'
b')'

and here it is for Outlook:

b'1 (BODY[] {5984}'
b' FLAGS (\\Seen) UID 354)'

so the fix is to simply concatenate them. I hope this doesn't break things for other servers, if it does we can just add a check for the length of data.

Also fixed a version check that's not necessary since Imbox is for 3.3+.