I\'m looking to return the n (most likely 10) most recent emails from an email accounts inbox using IMAP.
So far I\'ve cobbled together:
import imapl
# get recent one email from imap_tools import MailBox with MailBox('imap.mail.com').login('test@mail.com', 'password', 'INBOX') as mailbox: for message in mailbox.fetch(limit=1, reverse=True): print(msg.date_str, msg.subject)
https://github.com/ikvk/imap_tools