|
74 | 74 | use Symfony\Component\Lock\Store\FlockStore; |
75 | 75 | use Symfony\Component\Lock\Store\StoreFactory; |
76 | 76 | use Symfony\Component\Lock\StoreInterface; |
| 77 | +use Symfony\Component\Mailer\Mailer; |
77 | 78 | use Symfony\Component\Messenger\Handler\MessageHandlerInterface; |
78 | 79 | use Symfony\Component\Messenger\MessageBus; |
79 | 80 | use Symfony\Component\Messenger\MessageBusInterface; |
@@ -316,6 +317,10 @@ public function load(array $configs, ContainerBuilder $container) |
316 | 317 | $this->registerHttpClientConfiguration($config['http_client'], $container, $loader); |
317 | 318 | } |
318 | 319 |
|
| 320 | + if ($this->isConfigEnabled($container, $config['mailer'])) { |
| 321 | + $this->registerMailerConfiguration($config['mailer'], $container, $loader); |
| 322 | + } |
| 323 | + |
319 | 324 | if ($this->isConfigEnabled($container, $config['web_link'])) { |
320 | 325 | if (!class_exists(HttpHeaderSerializer::class)) { |
321 | 326 | throw new LogicException('WebLink support cannot be enabled as the WebLink component is not installed. Try running "composer require symfony/weblink".'); |
@@ -1854,6 +1859,16 @@ public function merge(array $options, array $defaultOptions) |
1854 | 1859 | } |
1855 | 1860 | } |
1856 | 1861 |
|
| 1862 | + private function registerMailerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) |
| 1863 | + { |
| 1864 | + if (!class_exists(Mailer::class)) { |
| 1865 | + throw new LogicException('Mailer support cannot be enabled as the component is not installed. Try running "composer require symfony/mailer".'); |
| 1866 | + } |
| 1867 | + |
| 1868 | + $loader->load('mailer.xml'); |
| 1869 | + $container->getDefinition('mailer.transport')->setArgument(0, $config['dsn']); |
| 1870 | + } |
| 1871 | + |
1857 | 1872 | /** |
1858 | 1873 | * Returns the base path for the XSD files. |
1859 | 1874 | * |
|
0 commit comments