tldr: Can someone show me how to properly format this Python iMAP example so it works?
from https://docs.python.org/2.4/lib/imap4-example.html
import getpass, imaplib M = imaplib.IMAP4() M.login(getpass.getuser(), getpass.getpass()) M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(RFC822)') print 'Message %s\n%s\n' % (num, data[0][1]) M.close() M.logout()
Assuming my email is "[email protected]" and the password is "password," how should this look? I tried M.login(getpass.getuser([email protected]), getpass.getpass(password))
and it timed out. Complete newb here, so it's very likely I missed something obvious (like creating an iMAP object first? Not sure).