Skip to content

Commit 701ccab

Browse files
committed
Add mailer in framework config reference
1 parent 52c2ca0 commit 701ccab

File tree

1 file changed

+122
-3
lines changed

1 file changed

+122
-3
lines changed

reference/configuration/framework.rst

Lines changed: 122 additions & 3 deletions
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`_
@@ -151,6 +151,18 @@ Configuration
151151

152152
* :ref:`name <reference-lock-resources-name>`
153153

154+
* `mailer`_
155+
156+
* :ref:`dsn <mailer-dsn>`
157+
* `transports`_
158+
* `message_bus`_
159+
* `envelope`_
160+
161+
* `sender`_
162+
* `recipients`_
163+
164+
* :ref:`headers <mailer-headers>`
165+
154166
* `php_errors`_
155167

156168
* `log`_
@@ -159,7 +171,7 @@ Configuration
159171
* `profiler`_
160172

161173
* `collect`_
162-
* `dsn`_
174+
* :ref:`dsn <profiler-dsn>`
163175
* :ref:`enabled <reference-profiler-enabled>`
164176
* `only_exceptions`_
165177
* `only_master_requests`_
@@ -835,6 +847,8 @@ ciphers
835847
A list of the names of the ciphers allowed for the SSL/TLS connections. They
836848
can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``).
837849

850+
.. _http-headers:
851+
838852
headers
839853
.......
840854

@@ -1039,6 +1053,8 @@ only_master_requests
10391053
When this is set to ``true``, the profiler will only be enabled on the master
10401054
requests (and not on the subrequests).
10411055

1056+
.. _profiler-dsn:
1057+
10421058
dsn
10431059
...
10441060

@@ -2819,6 +2835,109 @@ Name of the lock you want to create.
28192835
decorates: lock.invoice.store
28202836
arguments: ['@.inner', 100, 50]
28212837
2838+
mailer
2839+
~~~~~~
2840+
2841+
.. _mailer-dsn:
2842+
2843+
dsn
2844+
...
2845+
2846+
**type**: ``string``
2847+
2848+
The DSN used by the mailer. When several DSN may be used, use `transports` (see below) instead.
2849+
2850+
transports
2851+
..........
2852+
2853+
**type**: ``array``
2854+
2855+
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.
2856+
2857+
message_bus
2858+
...........
2859+
2860+
**type**: ``string`` | ``false``
2861+
2862+
Service identifier of the bus to use (when the messenger component is installed, for instance `messenger.default_bus`)
2863+
2864+
envelope
2865+
........
2866+
2867+
sender
2868+
""""""
2869+
2870+
**type**: ``string``
2871+
2872+
Sender used by the `Mailer`. Keep in mind that this setting override a sender set in the code.
2873+
2874+
recipients
2875+
""""""""""
2876+
2877+
**type**: ``array``
2878+
2879+
Recipients used by the `Mailer`. Keep in mind that this setting override recipients set in the code.
2880+
2881+
.. configuration-block::
2882+
2883+
.. code-block:: yaml
2884+
2885+
# config/packages/mailer.yaml
2886+
framework:
2887+
mailer:
2888+
dsn: 'smtp://localhost:25'
2889+
envelope:
2890+
2891+
2892+
.. code-block:: xml
2893+
2894+
<!-- config/packages/mailer.xml -->
2895+
<?xml version="1.0" encoding="UTF-8" ?>
2896+
<container xmlns="http://symfony.com/schema/dic/services"
2897+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2898+
xmlns:framework="http://symfony.com/schema/dic/symfony"
2899+
xsi:schemaLocation="http://symfony.com/schema/dic/services
2900+
https://symfony.com/schema/dic/services/services-1.0.xsd
2901+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
2902+
2903+
<framework:config>
2904+
<framework:mailer dsn="smtp://localhost:25">
2905+
<framework:envelope>
2906+
<framework:recipients>[email protected]</framework:recipients>
2907+
<framework:recipients>[email protected]</framework:recipients>
2908+
</framework:envelope>
2909+
</framework:mailer>
2910+
</framework:config>
2911+
</container>
2912+
2913+
.. code-block:: php
2914+
2915+
// config/packages/mailer.php
2916+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
2917+
2918+
return static function (ContainerConfigurator $containerConfigurator): void {
2919+
$containerConfigurator->extension('framework', [
2920+
'mailer' => [
2921+
'dsn' => 'smtp://localhost:25',
2922+
'envelope' => [
2923+
'recipients' => [
2924+
2925+
2926+
]
2927+
]
2928+
]
2929+
]);
2930+
};
2931+
2932+
.. _mailer-headers:
2933+
2934+
headers
2935+
.......
2936+
2937+
**type**: ``array``
2938+
2939+
Headers to add to emails. key (`name` attribute in xml format) is the header name and value the header value.
2940+
28222941
workflows
28232942
~~~~~~~~~
28242943

0 commit comments

Comments
 (0)