Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import os
  4. import sys
  5. import socket
  6. import time
  7. import email
  8. import imaplib
  9. import getpass
  10. import re
  11.  
  12. username = input("Username: ")
  13. password = getpass.getpass()
  14. mailbox = input("Mailbox: ")
  15.  
  16. conn = imaplib.IMAP4_SSL("imap.googlemail.com", 993)
  17. conn.login(username, password)
  18. mailboxes = conn.list()[1]
  19. for mailbox in mailboxes:
  20.     print(mailbox.decode('utf-8').split(' "/" "')[1].rstrip('"'))
  21. #conn.select(mailbox)
  22. #typ, data = conn.search(None, 'ALL')
  23. #for num in data[0].split():
  24. #    typ, data = conn.fetch(num, '(BODY.PEEK[])')
  25. #    print(data[0][1])
  26. #conn.close()
  27. conn.logout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement