Guest User

Untitled

a guest
Apr 21st, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import getpass, imaplib
  2. #your mail id = type your mail id
  3. #your password = type ypur password
  4. username = 'your mail id'
  5. password = 'your password'
  6. M = imaplib.IMAP4_SSL('IMAP.gmail.com',993)
  7. M.login(username, password)
  8. M.select()
  9. typ, data = M.search(None, 'UNSEEN')
  10. for num in data[0].split():
  11. typ, data = M.fetch(num, '(RFC822)')
  12. print 'Message %s\n%s\n' % (num, data[0][1])
  13. M.close()
  14. M.logout()
Add Comment
Please, Sign In to add comment