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

Mime Laravel Package

symfony/mime

Symfony MIME component for creating, parsing, and manipulating MIME email messages and parts. Build emails with attachments and embedded content, handle headers and encodings, and integrate with Symfony Mailer or other transports for robust message composition.

View on GitHub
Deep Wiki
Context7

Allows manipulating MIME messages

Frequently asked questions about Mime
How do I use Symfony MIME with Laravel’s Mail facade for sending transactional emails?
Symfony MIME is already integrated with Laravel’s Mail facade. Use `Mail::send()` or `Mail::raw()` with Symfony’s `Email` class to construct messages. For example, create an `Email` object, add headers/attachments, then pass it to Laravel’s Mailer. No extra setup is needed if you’re using Laravel 8+.
What’s the minimum PHP version required for Symfony MIME in Laravel applications?
Symfony MIME 8.x requires PHP 8.4+, while version 7.x supports PHP 7.4–8.3. Laravel 10+ (PHP 8.1+) works with Symfony 7.x or 8.x. Check your `composer.json` constraints to avoid conflicts. Use `symfony/mime:^7.4` for broader PHP 7.4–8.3 support.
Can I use Symfony MIME to create multipart emails with HTML and plain-text alternatives?
Yes. Symfony MIME’s `Email` class simplifies multipart emails. Add both HTML and plain-text bodies using `addPart()` with `Content-Type: text/html` or `text/plain`. The component handles encoding and proper MIME structure automatically, ensuring compatibility with email clients.
How do I handle attachments or embedded images in Laravel emails with Symfony MIME?
Use the `addAttachment()` method for files or `addEmbeddedImage()` for inline images. For Laravel, attach files via `Mail::send()` with the `attach()` method or manually via Symfony’s `Email` object. Embedded images require a `Content-ID` header, which Symfony MIME generates automatically for you.
Is Symfony MIME compatible with Laravel’s queue system for async email processing?
Yes. Symfony MIME works seamlessly with Laravel Queues. Construct your `Email` object, then pass it to `Mail::to()->queue()`. The MIME structure is preserved during queuing. For large attachments, Symfony MIME streams content efficiently, reducing memory usage.
What are the alternatives to Symfony MIME for MIME message handling in Laravel?
Alternatives include PHPMailer (standalone, widely used), Zend Mail (legacy, less maintained), and SwiftMailer (older, now deprecated). Symfony MIME stands out for its RFC compliance, modern PHP support, and tight Laravel integration. If you need a lightweight solution, PHPMailer is simpler, but Symfony MIME offers better scalability and standards adherence.
How do I customize MIME headers or add non-standard headers in Laravel emails?
Use the `setHeader()` method on Symfony’s `Email` or `Message` class. For Laravel, access the underlying Symfony object via `Mail::raw()` or extend Laravel’s `Mailable` class. Non-standard headers (e.g., `X-Priority`) are supported, but ensure compliance with email provider policies to avoid deliverability issues.
Does Symfony MIME support Laravel’s Storage facade for handling email attachments?
Yes. Symfony MIME works with Laravel’s Storage facade or any PSR-7-compatible stream. For attachments, use `addAttachment()` with a `StreamInterface` (e.g., from `Storage::disk('s3')->readStream()`). This enables dynamic attachment handling from cloud storage or databases.
How do I test Symfony MIME email generation in Laravel’s test environment?
Use Laravel’s `Mail::fake()` to assert emails are generated correctly. For MIME-specific tests, verify headers, body parts, and attachments with assertions like `assertEquals($expectedContentType, $email->getHeaders()->get('Content-Type'))`. Symfony MIME’s `Message` class also supports serialization for unit testing.
Are there any known performance issues with Symfony MIME for high-volume email campaigns?
Symfony MIME is optimized for performance, especially with large attachments or multipart messages. Benchmark your setup with tools like Blackfire or Laravel Debugbar. For high throughput (e.g., 10K+ emails/hour), use Laravel Queues and ensure your storage backend (e.g., S3) supports streaming attachments efficiently.
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.
hamzi/corewatch
minionfactory/raw-hydrator
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