I'm using imaplib module to parse some of my emails (I'm filtering on FROM field). To do that I'm looping over folders, but seem to miss some emails. When I go to my gmail folder, the emails I miss are exactly those, that don't have "Inbox" label. What the right way to retrieve all of them?
Here's some of my code:
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login(*,*)
folders = mail.list()
for f in folders[1]:
for allfolders in re.findall('"\/"(.*)',f):
folder = allfolders.replace(" ",'')
if mail.select(folder)[0] == "OK":
result, data = mail.search(None, '(FROM "*.*")' )
do my stuff with data
I've also tried
mail.select()
but it doesn't help.
UPDATE Problem solved by @Max: need to search in '[Gmail]/All Mail'