Download the PHP package fusonic/messenger-mailer-bundle without Composer
On this page you can find all versions of the php package fusonic/messenger-mailer-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fusonic/messenger-mailer-bundle
More information about fusonic/messenger-mailer-bundle
Files in fusonic/messenger-mailer-bundle
Package messenger-mailer-bundle
Short Description Symfony bundle for asynchronous e-mails with attachments through Symfony Messenger.
License MIT
Informations about the package messenger-mailer-bundle
messenger-mailer-bundle
- About
- Install
- Usage
- Contributing
About
You might need to bundle if your project fulfills the following criteria:
- You are using Symfony Mailer with Symfony Messenger.
- Your message queue containing the Mailer messages is running asynchronously.
- Your email contains attachments.
This bundle solves the following problems that can occur:
- If you use
Symfony\Component\Mime\Email::attach
the message will contain the entire file. Using blob data inside the message transport is not recommended and can lead to problems. - If you use
Symfony\Component\Mime\Email::attachFromPath
, the path might not exist at the moment of handling the message (depending on your implementation). An example is when you are generating a temporary file (such as a PDF) and want to attach it to the e-mail. If this is a temporary file it might get deleted before the message is handled.
Install
Use composer to install the bundle from packagist.
Requirements:
- PHP 8.2+
- Symfony 6.2+
In case Symfony did not add the bundle to the bundle configuration, add the following (by default located in config/bundles.php
):
Configuration (optional)
The only thing you are required to configure is the provided middleware on your message bus that
handles the SendEmailMessage
event.
If you want to use a different service for attachment handling, you can create your own and overwrite the default in your service configuration.
You can for example create a handler that would save the attachments with an abstract filesystem (e.g.: thephpleague/flysystem
).
Usage
This bundle provides two classes for creating e-mails AttachmentEmail (extension of the Symfony Email
class)
and TemplatedAttachmentEmail (extension of the Symfony TemplatedEmail
class).
Instead of using attach
, attachFromPath
and addPart
you should use addPersistedPart
.
This will persist the content depending on the FilesystemAttachmentHandler
. This way the email can be safely handled asynchronously.
Contributing
This is a subtree split of fusonic/php-extensions repository. Please create your pull requests there.
All versions of messenger-mailer-bundle with dependencies
symfony/mime Version ^6.2 || ^7.0
symfony/http-kernel Version ^6.2 || ^7.0
symfony/config Version ^6.2 || ^7.0
symfony/dependency-injection Version ^6.2 || ^7.0
symfony/messenger Version ^6.2 || ^7.0
symfony/filesystem Version ^6.2 || ^7.0
symfony/yaml Version ^6.2 || ^7.0
symfony/mailer Version ^6.2 || ^7.0
symfony/twig-bridge Version ^6.2 || ^7.0