diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 48d789a5..d49964b1 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -175,6 +175,7 @@ * - subject: string * - [level]: level name or int value, defaults to DEBUG * - [bubble]: bool, defaults to true + * - [headers]: optional array containing additional headers * * - socket: * - connection_string: string @@ -594,6 +595,10 @@ public function getConfigTreeBuilder() ->end() ->scalarNode('subject')->end() // swift_mailer and native_mailer ->scalarNode('content_type')->defaultNull()->end() // swift_mailer + ->arrayNode('headers') // native_mailer + ->canBeUnset() + ->scalarPrototype()->end() + ->end() ->scalarNode('mailer')->defaultValue('mailer')->end() // swift_mailer ->arrayNode('email_prototype') // swift_mailer ->canBeUnset() diff --git a/DependencyInjection/MonologExtension.php b/DependencyInjection/MonologExtension.php index 285e9b81..500a041b 100644 --- a/DependencyInjection/MonologExtension.php +++ b/DependencyInjection/MonologExtension.php @@ -540,6 +540,9 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler $handler['level'], $handler['bubble'], )); + if (!empty($handler['headers'])) { + $definition->addMethodCall('addHeader', $handler['headers']); + } break; case 'socket': diff --git a/Resources/config/schema/monolog-1.0.xsd b/Resources/config/schema/monolog-1.0.xsd index cf0eac87..6c23e93a 100644 --- a/Resources/config/schema/monolog-1.0.xsd +++ b/Resources/config/schema/monolog-1.0.xsd @@ -88,6 +88,7 @@ + @@ -186,4 +187,10 @@ + + + + + +