--- id: mailbits version: "0.2.3" license: MIT license_treatment: permissive maintenance: active --- # mailbits — Assorted e-mail utility functions License: permissive · Maintenance: active · Downloads: 334.7K/mo ## What it is and what it does mailbits is a small utility library that wraps Python's standard email module to make working with Message, EmailMessage, Address, and Group objects simpler and more inspectable. It provides functions to parse Content-Type headers into structured objects, convert email messages into plain Python dicts for easier inspection and comparison, extract recipient addresses, and convert between the older Message class and newer EmailMessage format. The main use case is when you need to examine or manipulate email messages programmatically but find the standard library's API cumbersome—for instance, when comparing two messages for equality, pretty-printing message structure, or extracting specific address fields. The dict conversion handles nested multipart messages, decodes encoded text and bytes, and provides special representations for headers like From, To, and Content-Type. Use it for: - Convert email Message objects to dicts for easier testing and comparison in unit tests - Parse and inspect Content-Type headers to extract media type and parameters - Extract and format recipient email addresses from EmailMessage objects - Convert legacy Message instances to the newer EmailMessage format - Pretty-print or log the structure of a multipart email for debugging ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides utilities for parsing, converting, and inspecting email Message and EmailMessage objects from Python's standard library, including Content-Type parsing, message-to-dict conversion, and address extraction. Yes. mailbits is actively maintained, has no known vulnerabilities, low install friction, and a permissive MIT license. It solves a real friction point in the standard library's email API. Install it if you work with email messages and need cleaner introspection or conversion utilities. ## Install pip install mailbits uv add mailbits poetry add mailbits ## Installing mailbits Before you install: Low install friction with a single lightweight dependency. Actively maintained with recent commits; requires Python 3.10 or higher. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, suitable for both open-source and commercial projects. Quickstart: pip install mailbits from mailbits import ContentType, email2dict ct = ContentType.parse("text/plain; charset=utf-8") print(ct.maintype, ct.subtype) msg_dict = email2dict(msg) Requires Python 3.10 or higher Verify before relying: - Whether the package handles all RFC 5322 edge cases or has known parsing limitations - Performance characteristics when processing large or deeply nested multipart messages - Whether attrs is required at runtime or only for development ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 334.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags email message parsing utilities, convert email message to dict, parse content-type headers, extract email addresses, email inspection tools, message structure analysis, emailmessage utilities, email-utilities, message-parsing [View on SkillFed](https://skillfed.io/packages/mailbits) · [View on PyPI](https://pypi.org/project/mailbits/)