Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mail Mime Parser Laravel Package

zbateson/mail-mime-parser

PSR-compliant, testable MIME email parser for PHP (RFC 822/2822/5322). A standards-based but forgiving alternative to imap* and Pear for reading and inspecting messages, headers, parts, and attachments. Requires PHP 8.1+.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Email Processing Pipeline: Enables building a robust email parsing system for applications requiring MIME-compliant email handling (e.g., ticketing systems, CRM integrations, or internal communication tools).
  • Security & Compliance: Facilitates parsing encrypted/signed emails (via companion packages) for compliance-heavy industries (e.g., healthcare, finance) or secure internal messaging.
  • Legacy System Modernization: Replaces outdated imap_* functions or PEAR libraries, reducing technical debt and improving maintainability.
  • Feature Roadmap:
    • Email Attachment Processing: Extract, validate, and store attachments (e.g., for document management systems).
    • Email Analytics: Parse headers/metadata for sentiment analysis, routing, or archiving (e.g., "From," "Subject," "Received" headers).
    • Multi-Channel Integrations: Bridge email data with APIs (e.g., Slack notifications, database imports).
  • Build vs. Buy: Buy—avoids reinventing MIME parsing logic, reducing dev time and risk. Justifies cost if email parsing is a core feature (not a niche use case).
  • Use Cases:
    • Customer Support: Auto-extract attachments from tickets (e.g., invoices, screenshots).
    • Marketing Automation: Parse campaign emails for open rates, link clicks (via HTML content).
    • Internal Tools: Parse internal emails for workflow triggers (e.g., "reply-all" to support@ auto-creates a ticket).

When to Consider This Package

  • Adopt When:

    • Your app requires RFC 5322-compliant MIME parsing (e.g., handling complex emails with nested attachments, multipart bodies, or custom headers).
    • You need PSR-compliant, testable code with modern PHP (8.1+) support.
    • Encrypted/signed emails (S/MIME or PGP) are part of your workflow (via companion packages).
    • You’re replacing imap_* functions or PEAR libraries (e.g., Mail_mimeDecode) for better performance or maintainability.
    • Your team lacks expertise in MIME parsing but needs a reliable, well-documented solution.
  • Look Elsewhere If:

    • You only need basic email parsing (e.g., plaintext subjects/body) and can use PHP’s built-in mb_parse_str() or imap_fetchbody().
    • Your stack is non-PHP (e.g., Node.js, Python)—consider native libraries like email (Python) or nodemailer (JS).
    • You require real-time email sending (not parsing)—use a dedicated library like phpmailer or symfony/mailer.
    • Your emails are extremely simple (no attachments, HTML, or encoding)—a regex-based solution might suffice.
    • You need GUI-based email handling (e.g., for end-users)—consider integrating with an existing email client API (e.g., Microsoft Graph, Gmail API).

How to Pitch It (Stakeholders)

For Executives:

*"This package lets us process emails like a first-party feature—without building a custom parser from scratch. It’s used by teams at SecuMailer to handle encrypted emails securely, and it’s PSR-compliant, meaning our devs can integrate it cleanly with Laravel or any modern PHP app. For example:

  • Customer Support: Auto-extract attachments from emails to tickets, cutting manual work by 30%.
  • Compliance: Parse S/MIME emails for healthcare/finance use cases without reinventing the wheel.
  • Reliability: Replaces flaky imap_* functions with a tested, maintained library (last release: March 2026).

It’s a low-risk, high-reward decision—we avoid technical debt while enabling features like email-based workflows or analytics. The cost? Minimal: a Composer dependency and a few hours of dev time to integrate."*


For Engineering:

*"Why this over alternatives?

  • Modern PHP: Requires PHP 8.1+, aligns with our stack.
  • Performance: Optimized for parsing large/complex emails (e.g., nested attachments, multipart bodies).
  • Extensibility:
    • Supports S/MIME/PGP via companion packages (critical for security use cases).
    • PSR-7 streams for memory-efficient handling of large attachments.
    • Error handling built-in (e.g., malformed headers won’t crash the app).
  • Maintenance: Actively developed (releases every 6–12 months), with 542 stars and a clear upgrade path.

Integration Plan:

  1. Spike: Test parsing a sample of our worst-case emails (e.g., with attachments, HTML, or encoding issues).
  2. API Design: Expose parsed data via a service class (e.g., EmailParserService) with methods like:
    • extractAttachments($email) → returns array of files.
    • getEmailMetadata($email) → returns structured headers (e.g., ['from', 'subject', 'sent_at']).
  3. Edge Cases: Handle encrypted emails (if needed) with the S/MIME plugin.
  4. Monitor: Log parsing errors to track issues early.

Trade-offs:

  • No IMAP dependency: Unlike imap_*, this parses raw email strings/streams—we’ll need to fetch emails via API/IMAP first.
  • Learning curve: Team will need to understand MIME structures, but the API is well-documented.

Alternatives Considered:

  • Pear Mail_mimeDecode: Outdated, no PHP 8+ support.
  • Custom regex/string parsing: High maintenance, no error handling.
  • GuzzleHttp/Psr7: Overkill for parsing; this library handles MIME natively.

Recommendation: Proceed with a 2-week spike to validate performance and edge-case handling. If successful, prioritize integration for [high-impact use case, e.g., support tickets]."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai