0

Have a bit of a problem and hoping you can help me

What i am trying to do

  1. Connect to gmail Via Imap
  2. Loop through a list of subjects to search for
  3. Select the id and go and download the attachment
  4. got it working for 1 but when i go to run the loop through the List(searchlist)

I am getting an error

is the imaplib able to do this

try:
    for i in range(len(searchlist)):
        #print(str(searchlist[i]))
        print(str(searchlist[i]))
        imapSession.select('Inbox')
        typ, data = imapSession.search(None, str(searchlist[i]))
        print(data)
        if typ != 'OK':

            print('Error searching Inbox.')
            raise

I am not getting anything back from the print(data)

thanks in advance for any help!!

pgodkin
  • 3
  • 2
  • Sorry Meant to add not really getting an error but not getting anything back, when i pass a string of a '(SUBJECT "EXAMPLE")' it works – pgodkin Aug 21 '18 at 16:29
  • Hi! Can you please show us what search list looks like? You also don't need to reselect Inbox fr every search. That's very expensive. Do it once outside the loop. – Max Aug 21 '18 at 22:05

0 Answers0