Imapy is a Python library that simplifies working with the IMAP protocol, making it more accessible and user-friendly.
- Easy-to-use interface for IMAP operations
- Support for searching and filtering emails
- Handling of email attachments
- Folder management capabilities
- Python 3.9 or higher
You can install Imapy using pip:
pip install imapy
import imapy
# Connect to an IMAP server
em = imapy.connect(
host='imap.example.com',
username='your_username',
password='your_password',
ssl=True
)
# List all folders
folders = em.folders()
# Select a folder and get emails
emails = em.folder('Inbox').emails()
# Perform operations on emails
for email in emails:
print(f"Subject: {email.subject}")
print(f"From: {email.sender}")
# Logout
em.logout()
This project uses Poetry for dependency management and Black for code formatting.
To set up the development environment:
- Ensure you have Python 3.9 or higher installed
- Install Poetry
- Clone the repository
- Run
poetry install
to install dependencies - Run
poetry run pre-commit install
to set up the pre-commit hooks
To format the code, run:
poetry run format
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.