Skip to content

Commit ab4f4c6

Browse files
committed
Add mailer in framework config reference
1 parent 21ce2ac commit ab4f4c6

File tree

1 file changed

+123
-3
lines changed

1 file changed

+123
-3
lines changed

reference/configuration/framework.rst

+123-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Configuration
9898
* `cafile`_
9999
* `capath`_
100100
* `ciphers`_
101-
* `headers`_
101+
* :ref:`headers <http-headers>`
102102
* `http_version`_
103103
* `local_cert`_
104104
* `local_pk`_
@@ -126,7 +126,7 @@ Configuration
126126
* `cafile`_
127127
* `capath`_
128128
* `ciphers`_
129-
* `headers`_
129+
* :ref:`headers <http-headers>`
130130
* `http_version`_
131131
* `local_cert`_
132132
* `local_pk`_
@@ -174,6 +174,18 @@ Configuration
174174

175175
* :ref:`name <reference-lock-resources-name>`
176176

177+
* `mailer`_
178+
179+
* :ref:`dsn <mailer-dsn>`
180+
* `transports`_
181+
* `message_bus`_
182+
* `envelope`_
183+
184+
* `sender`_
185+
* `recipients`_
186+
187+
* :ref:`headers <mailer-headers>`
188+
177189
* `php_errors`_
178190

179191
* `log`_
@@ -182,7 +194,7 @@ Configuration
182194
* `profiler`_
183195

184196
* `collect`_
185-
* `dsn`_
197+
* :ref:`dsn <profiler-dsn>`
186198
* :ref:`enabled <reference-profiler-enabled>`
187199
* `only_exceptions`_
188200
* `only_master_requests`_
@@ -915,6 +927,8 @@ enabled
915927
Whether to enable the support for retry failed HTTP request or not.
916928
This setting is automatically set to true when one of the child settings is configured.
917929

930+
.. _http-headers:
931+
918932
headers
919933
.......
920934

@@ -1196,6 +1210,8 @@ only_master_requests
11961210
When this is set to ``true``, the profiler will only be enabled on the master
11971211
requests (and not on the subrequests).
11981212

1213+
.. _profiler-dsn:
1214+
11991215
dsn
12001216
...
12011217

@@ -2973,6 +2989,110 @@ Name of the lock you want to create.
29732989
decorates: lock.invoice.store
29742990
arguments: ['@.inner', 100, 50]
29752991
2992+
mailer
2993+
~~~~~~
2994+
2995+
.. _mailer-dsn:
2996+
2997+
dsn
2998+
...
2999+
3000+
**type**: ``string``
3001+
3002+
The DSN used by the mailer. When several DSN may be used, use `transports` (see below) instead.
3003+
3004+
transports
3005+
..........
3006+
3007+
**type**: ``array``
3008+
3009+
A :ref:`list of DSN <multiple-email-transports>` that can be used by the mailer. A transport name is the key and the dsn is the value.
3010+
3011+
message_bus
3012+
...........
3013+
3014+
**type**: ``string`` | ``false``
3015+
3016+
Service identifier of the bus to use (when the messenger component is installed, for instance `messenger.default_bus`)
3017+
3018+
envelope
3019+
........
3020+
3021+
sender
3022+
""""""
3023+
3024+
**type**: ``string``
3025+
3026+
Sender used by the ``Mailer``. Keep in mind that this setting override a sender set in the code.
3027+
3028+
recipients
3029+
""""""""""
3030+
3031+
**type**: ``array``
3032+
3033+
Recipients used by the ``Mailer``. Keep in mind that this setting override recipients set in the code.
3034+
3035+
.. configuration-block::
3036+
3037+
.. code-block:: yaml
3038+
3039+
# config/packages/mailer.yaml
3040+
framework:
3041+
mailer:
3042+
dsn: 'smtp://localhost:25'
3043+
envelope:
3044+
3045+
3046+
.. code-block:: xml
3047+
3048+
<!-- config/packages/mailer.xml -->
3049+
<?xml version="1.0" encoding="UTF-8" ?>
3050+
<container xmlns="http://symfony.com/schema/dic/services"
3051+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3052+
xmlns:framework="http://symfony.com/schema/dic/symfony"
3053+
xsi:schemaLocation="http://symfony.com/schema/dic/services
3054+
https://symfony.com/schema/dic/services/services-1.0.xsd
3055+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
3056+
3057+
<framework:config>
3058+
<framework:mailer dsn="smtp://localhost:25">
3059+
<framework:envelope>
3060+
<framework:recipients>[email protected]</framework:recipients>
3061+
<framework:recipients>[email protected]</framework:recipients>
3062+
</framework:envelope>
3063+
</framework:mailer>
3064+
</framework:config>
3065+
</container>
3066+
3067+
.. code-block:: php
3068+
3069+
// config/packages/mailer.php
3070+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
3071+
3072+
return static function (ContainerConfigurator $containerConfigurator): void {
3073+
$containerConfigurator->extension('framework', [
3074+
'mailer' => [
3075+
'dsn' => 'smtp://localhost:25',
3076+
'envelope' => [
3077+
'recipients' => [
3078+
3079+
3080+
]
3081+
]
3082+
]
3083+
]);
3084+
};
3085+
3086+
.. _mailer-headers:
3087+
3088+
headers
3089+
.......
3090+
3091+
**type**: ``array``
3092+
3093+
Headers to add to emails. key (``name`` attribute in xml format)
3094+
is the header name and value the header value.
3095+
29763096
workflows
29773097
~~~~~~~~~
29783098

0 commit comments

Comments
 (0)