gmail poplib python 2.7
Gmail works best in SSL mode. Find out the number of emails in your gmail inbox.
- Credentials are input from the keyboard, even with an extra example of hiding the password as opposed to placing the credentials in the program (which would be good for crontab scripts)
#!/usr/bin/python import poplib,getpass poPserver = poplib.POP3_SSL("pop.gmail.com", 995) poPuser = raw_input('Username:') print poPserver.user(poPuser) print poPserver.pass_(getpass.getpass()) messageCount = len(poPserver.list()) print messageCount, "messages"