Allow manipulating mail data with MailBeforeSentEvent
Currently, MailBeforeSentEvent has no setter methods to manipulate mail data.
The Symfony documentation describes such an event where one could update subject and message properties: https://symfony.com/doc/current/event_dispatcher.html#how-to-customize-a-method-behavior-without-using-inheritance
My use case is that I want to edit the mail contents. For that, I need to adjust the return value of the private method "buildContents". That seems not possible with a decorator.
A workaround is to completely replace the core MailService class:
<service id="Shopware\Core\Content\Mail\Service\MailService" class="MyPlugin\Service\MailService">
...
</service>
That, however, will lead to breaking changes if the MailService class gets patched in the future.
Not enough interest
We’re closing this idea because it has not received significant interest or activity over the past 12 months. This helps us keep the idea portal focused on the topics that are most relevant to our community.
Thank you for taking the time to submit and support it. We’ll continue to monitor customer needs and may reconsider the topic if interest grows in the future.