Mautic Community Forums

Swiftmailer.default.plugin not fired in custom plugin

Hello, I’m developing a custom plugin and I want to make some action before an email is send.

If I set muy plugin as here https://swiftmailer.symfony.com/docs/plugins.html it works ok, but I have to change EmailBundle/Helper/MailHelper.php, something that I don’t want.

I want to register the swiftmailer plugin on my plugin config, as shown here: https://symfony.com/doc/3.4/reference/dic_tags.html#swiftmailer-default-plugin so in my plugin conf y have:

   'services' => [
        'events'=>[
            'swiftmailer.default.plugin.quota' => [
                'class' => 'MauticPlugin\CampaingExtensionBundle\EventListener\Swift_Plugins_Quota',
                'arguments' => [],
                'tags' => [
                    'swiftmailer.default.plugin'
                ]
            ],
        ]

But in this case is never fired. Any help?