print(mail.list())
print('')
if mail.stat()[1] > 0:
    print('You have new mail.')
else:
    print('No new mail.')
print('')
numMessages = len(mail.list()[1])
for i in range(numMessages):
    for j in mail.retr(i + 1)[1]:
        msg = email.message_from_string(j)
print(msg.get_payload())
mail.quit()
eval(input('Press any key to continue.'))
Python: Retrieving only POP3 message text, no headers