Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import email
- import imaplib
- server = "imap.mail.ru"
- port = "993"
- login = "[email protected]"
- password = "moms_lover"
- imaplib.Debug = 4
- get_mail = imaplib.IMAP4_SSL(server, port)
- get_mail.login(login, password)
- get_mail.select('INBOX', readonly=True)
- typ, data = get_mail.search(None, 'UNSEEN')
- for i in data[0].split():
- typ, data = get_mail.fetch(i, '(RFC822)')
- print(data[0][1])
- msg_string = data[0][1].decode('utf-8')
- msg = email.message_from_string(msg_string)
- for part in msg.walk():
- if part.get_content_type() == "text/plain":
- txt_msg = part.get_payload()
- print(txt_msg)
- #list = [txt_msg] - список для теста
- #print(list)
- else:
- continue
- get_mail.close()
- get_mail.logout()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement