I\'d like to fetch the whole message from IMAP4 server. In python docs if found this bit of code that works:
>>> t, data = M.fetch(\'1\', \'(RFC822)
You may use imap_tools package: https://pypi.org/project/imap-tools/
Features:
example:
from imap_tools import MailBox
# get list of email bodies from INBOX folder
with MailBox('imap.mail.com').login('test@mail.com', 'password', 'INBOX') as mailbox:
bodies = [msg.text or msg.html for msg in mailbox.fetch()]