Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from imaplib import IMAP4_SSL
- import email
- host = "mail.corp.itclover.ru"
- port = '993'
- user = "nujina.arina"
- password = "1Qwertyu"
- connection = IMAP4_SSL(host=host, port=port)
- connection.login(user=user, password=password)
- status, msgs = connection.select('inbox')
- #print(msgs)
- # assert status == 'OK'
- #
- typ, data = connection.search(None, 'ALL')
- #print(data)
- for num in data[0].split():
- typ, message_data= connection.fetch(num, '(RFC822)')
- # print(data)
- # print('Message %s\n%s\n' % (num, message_data[0][1]))
- mail = email.message_from_bytes(message_data[0][1])
- a = mail._payload[0]
- a=a._payload
- print(a)
- #print(a.encode('ascii'))
- #print(mail)
- # if mail.is_multipart():
- # for part in mail.walk():
- # content_type = part.get_content_type()
- # filename = part.get_filename()
- # if filename:
- # with open(part.get_filename(), 'wb') as new_file:
- # new_file.write(part.get_payload(decode=True))
- connection.close()
- connection.logout()
- #465
- #993
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement