Skip to content

Welcome to email-profile

Documentation  •  PyPI  •  Source Code

GitHub Org's stars GitHub last commit PyPI PyPI - Python Version PyPI - Downloads

A Python library for email management. Connect to any IMAP/SMTP server, read and send emails, sync your mailbox to a local database, and restore backups — all with a single, unified API.

"""Read your unread mail in 4 lines."""

from email_profile import Email


def main() -> None:
    with Email.from_env() as app:
        for msg in app.unread().messages():
            print(f"{msg.date}  {msg.from_:<40}  {msg.subject}")


if __name__ == "__main__":
    main()

Start with the basics here.

Features

Feature Description
Auto-discovery Detects IMAP/SMTP servers from email domain (50+ providers)
Unified API IMAP + SMTP in a single Email class
Query Builder Composable search with Q (AND, OR, NOT) and validated Query kwargs
Sync Incremental backup from server to SQLite with progress bars
Restore Upload emails back to server with duplicate detection
Parallel Multi-threaded sync and restore with configurable workers
Progress Rich progress bars with per-mailbox status
Retry Exponential backoff on transient failures
Send Send, reply, forward with HTML and attachments
Storage Pluggable storage backend (SQLite default)
Flags Read/unread, flag, delete, move, copy operations
Context Manager with Email(...) as app: for automatic cleanup

Getting Help

We use GitHub issues for tracking bugs and feature requests.

License

This project is licensed under the terms of the MIT license.