I have the following code to check messages in my inbox:
M = imaplib.IMAP4_SSL('imap.url.com')
M.login('myemail@my.com','myPassword')
M.select('inbox')
typ, data = M.search(None, 'ALL')
print(data)
Let's say i have two email in my inbox, the output would be something like:
[b'1 2']
However, when i delete or move these two emails to an other folder, my program keeps saying i have them there in inbox.
[b'1 2']
This is causing my program to crush, since i check (fetch) the content of these emails later in my code & when the (search) says we still have emails in inbox then the (fetch) will try to go through them and won't find a thing. It will throw then the error:
FETCH failed: Internal error occurred. Refer to server log for more information
this will happen for a long period (20 minutes) till the search command sends back the correct result.
Is there a cache management i should take care of?
It is worth mentioning that my Email server is aws.