Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import imaplib
- import base64
- email_user = input('Email: ') # iamanwander@gmail.com
- email_pass = input('Password: ') #aman@cbtl22
- M = imaplib.IMAP4_SSL('imap.gmail.com', 993)
- M.login(email_user, email_pass)
- M.select()
- typ, message_numbers = M.search(None, 'ALL')
- for num in message_numbers[0].split():
- typ, data = M.fetch(num, '(RFC822)')
- # num1 = base64.b64decode(num) # unnecessary, I think
- print(data) # check what you've actually got. That will help with the next line
- data1 = base64.b64decode(data[0][1])
- print('Message %s\n%s\n' % (num, data1))
- M.close()
- M.logout()
Add Comment
Please, Sign In to add comment