SHARE
TWEET

Fetching the Email on Top from your Gmail account

kanchanrocker Aug 17th, 2014 144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import imaplib
  2. mailserver=imaplib.IMAP4_SSL("imap.gmail.com",993)
  3. uemail=raw_input("Enter your Email::")
  4. password=raw_input("Enter your Password::")
  5. mailserver.login(str(uemail),str(password))
  6. status,count=mailserver.select("Inbox")
  7. status,data=mailserver.fetch(count[0],"UID BODY [TEXT]")
  8. print data[0],[1]
  9. mailserver.close()
RAW Paste Data
Pastebin PRO Autumn Special!
Get 40% OFF on Pastebin PRO accounts!
Top