The Swift Mailer channel is sending messages as email via the Swift Mailer library.
If you want to use this channel, the SwiftmailerBundle
must be installed, enabled and configured.
yokai_messenger:
channels:
swiftmailer:
enabled: true
from: [email protected]
translator_catalog: notifications
yokai_messenger:
messages:
-
id: <up to you>
channels: swiftmailer # or [swiftmailer, <any other channels ...>]
yokai_messenger:
messages:
-
id: <up to you>
channels: swiftmailer # or [swiftmailer, <any other channels ...>]
options:
swiftmailer:
from: [email protected]
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Yokai\MessengerBundle\DependencyInjection\Factory\MessageDefinitionFactory;
public function load(array $configs, ContainerBuilder $container)
{
MessageDefinitionFactory::create($container, '<up to you>', ['swiftmailer'], [], []);
}
This channel supports :
- objects that implements
Yokai\MessengerBundle\Recipient\SwiftmailerRecipientInterface
interface - string that looks like an email (see
filter_var
withFILTER_VALIDATE_EMAIL
)
The channel is only responsible for creating Swift_Message
instance,
and sending it through the application mailer (Swift_Mailer
).
The Swift_Message
configuration is done by a chain of configurator
,
you can plug-in into this process by creating your own configurator
.
Creating a configurator is as simple as creating a service that implements
Yokai\MessengerBundle\Channel\Swiftmailer\Configurator\SwiftMessageConfiguratorInterface
with the yokai_yokai_messenger.swiftmailer_message_configurator
tag.
This bundle come with some built-in configurator
:
Yokai\MessengerBundle\Channel\Swiftmailer\Configurator\DefaultMessageConfigurator