--- id: mail-parser version: "4.6.2" license: Apache-2.0 license_treatment: permissive maintenance: active --- # mail-parser — A tool that parses emails by enhancing the Python standard library, extracting all details into a comprehensive object. License: permissive · Maintenance: active · Downloads: 3.2M/mo ## What it is and what it does mail-parser is a production-grade email parsing library that transforms raw email messages into richly structured Python objects. It goes beyond Python's standard email module by extracting every component—headers, plain-text and HTML bodies, attachments with full metadata, routing chains from Received headers, and RFC defects—into a unified object model. Every parsed element is accessible in three formats: native Python objects for direct use, raw strings preserving original formatting, and JSON for integration with external systems. The library is built for security and forensics use cases, with particular strength in detecting malformed structures, RFC violations, and hidden content that could indicate malicious intent. It natively handles both standard .eml files and Microsoft Outlook .msg files (via the optional extract-msg backend). With no runtime dependencies and support for Python 3.9 through 3.14, it is designed to integrate into production email security pipelines, threat analysis platforms, and compliance workflows. Use it for: - Security analysis: detect malformed email structures, RFC violations, and anomalies that may indicate phishing or malware. - Email forensics: extract complete routing chains, timestamps, and metadata for incident investigation and evidence preservation. - Outlook integration: parse .msg files from Microsoft Outlook alongside standard .eml messages in unified workflows. - Compliance auditing: extract and validate email headers and routing for regulatory requirements and audit trails. - Threat intelligence: feed parsed email components into automated detection systems for spam, phishing, and malware analysis. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses raw email messages into structured Python objects with RFC compliance, extracting headers, bodies, attachments, routing information, and defects for security analysis and forensics. Yes. mail-parser is actively maintained, has no runtime dependencies, supports current Python versions, carries a permissive Apache-2.0 license, and has no known vulnerabilities. It is purpose-built for email security and forensics with proven production use. Install it if you need reliable, RFC-compliant email parsing with security-focused defect detection; the optional Outlook support makes it versatile for mixed email ecosystems. ## Install pip install mail-parser uv add mail-parser poetry add mail-parser ## Installing mail-parser Before you install: Low friction installation with no runtime dependencies. Actively maintained with a release 2 days ago and support for current Python versions (3.9–3.14). Optional Outlook support via the `[outlook]` extra. License in practice: Apache-2.0 permissive license allows free use, modification, and distribution with minimal restrictions, suitable for both open-source and commercial projects. Quickstart: pip install mail-parser from mail_parser import parse_from_file mail = parse_from_file('message.eml') print(mail.from_, mail.to, mail.subject) Requires Python 3.9 or later. Optional: install mail-parser[outlook] for native .msg file support via extract-msg. Verify before relying: - Exact performance characteristics (parsing speed, memory usage) for large-scale deployments or very large attachments. - Completeness of RFC compliance coverage—which specific RFCs are fully supported versus partially. - Availability and quality of API documentation beyond the description excerpt. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 3.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags email parsing library, RFC-compliant email parser, email security analysis, extract email headers and attachments, email forensics tool, parse eml and msg files, email threat detection, email-security, forensics, rfc-compliant [View on SkillFed](https://skillfed.io/packages/mail-parser) · [View on PyPI](https://pypi.org/project/mail-parser/)