pip install inbox.py
python
from inbox import Inbox
inbox = Inbox()
inbox.hostname = "your.mail.server.com"
inbox.username = "your_username"
inbox.password = "your_password"
@inbox.collate
def handle(to, sender, subject, body):
print(f"New email from: {sender}")
print(f"Subject: {subject}")
print(f"Body: {body}")
inbox.start()