Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit074db0d

Browse files
committed
Complete mailer integration
1 parentf5e0f47 commit074db0d

File tree

2 files changed

+162
-3
lines changed

2 files changed

+162
-3
lines changed

‎mailer.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,58 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
2929
# .env
3030
MAILER_DSN=smtp://user:pass@smtp.example.com:port
3131
32+
..configuration-block::
33+
34+
..code-block::yaml
35+
36+
# config/packages/mailer.yaml
37+
framework:
38+
mailer:
39+
dsn:'%env(MAILER_DSN)%'
40+
41+
..code-block::xml
42+
43+
<!-- config/packages/mailer.xml-->
44+
<?xml version="1.0" encoding="UTF-8" ?>
45+
<containerxmlns="http://symfony.com/schema/dic/services"
46+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
47+
xmlns:framework="http://symfony.com/schema/dic/symfony"
48+
xsi:schemaLocation="http://symfony.com/schema/dic/services
49+
https://symfony.com/schema/dic/services/services-1.0.xsd
50+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
51+
<framework:config>
52+
<framework:mailerdsn="%env(MAILER_DSN)%"/>
53+
</framework:config>
54+
</container>
55+
56+
..code-block::php
57+
58+
// config/packages/mailer.php
59+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
60+
return static function (ContainerConfigurator $containerConfigurator): void {
61+
$containerConfigurator->extension('framework', [
62+
'mailer' => [
63+
'dsn' => '%env(MAILER_DSN)%',
64+
]
65+
]);
66+
};
67+
3268
..caution::
3369

3470
If you are migrating from Swiftmailer (and the Swiftmailer bundle), be
3571
warned that the DSN format is different.
3672

73+
Using built-in transports
74+
~~~~~~~~~~~~~~~~~~~~~~~~~
75+
76+
============ ==================================== ===========
77+
DSN protocol Example Description
78+
============ ==================================== ===========
79+
smtp smtp://user:pass@smtp.example.com:25 Mailer uses an SMTP server to send emails
80+
sendmail sendmail://default Mailer uses the local sendmail binary to send emails
81+
============ ==================================== ===========
82+
83+
3784
Using a 3rd Party Transport
3885
~~~~~~~~~~~~~~~~~~~~~~~~~~~
3986

@@ -822,6 +869,8 @@ and it will select the appropriate certificate depending on the ``To`` option::
822869
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
823870
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
824871

872+
.. _multiple-email-transports:
873+
825874
Multiple Email Transports
826875
-------------------------
827876

‎reference/configuration/framework.rst

Lines changed: 113 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,17 @@ Configuration
151151

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

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

156167
* `log`_
@@ -159,7 +170,7 @@ Configuration
159170
* `profiler`_
160171

161172
* `collect`_
162-
* `dsn`_
173+
*:ref:`dsn<profiler-dsn>`
163174
*:ref:`enabled<reference-profiler-enabled>`
164175
* `only_exceptions`_
165176
* `only_master_requests`_
@@ -867,6 +878,8 @@ ciphers
867878
A list of the names of the ciphers allowed for the SSL/TLS connections. They
868879
can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``).
869880

881+
.. _http-headers:
882+
870883
headers
871884
.......
872885

@@ -1075,6 +1088,8 @@ only_master_requests
10751088
When this is set to ``true``, the profiler will only be enabled on the master
10761089
requests (and not on the subrequests).
10771090

1091+
.. _profiler-dsn:
1092+
10781093
dsn
10791094
...
10801095

@@ -2888,6 +2903,101 @@ Name of the lock you want to create.
28882903
decorates:lock.invoice.store
28892904
arguments:['@lock.invoice.retry_till_save.store.inner', 100, 50]
28902905
2906+
mailer
2907+
~~~~~~
2908+
2909+
.. _mailer-dsn:
2910+
2911+
dsn
2912+
...
2913+
2914+
**type**: ``string``
2915+
2916+
The DSN used by the mailer. When several DSN may be used, use `transports` (see below) instead.
2917+
2918+
transports
2919+
..........
2920+
2921+
**type**: ``array``
2922+
2923+
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.
2924+
2925+
envelope
2926+
........
2927+
2928+
sender
2929+
""""""
2930+
2931+
**type**: ``string``
2932+
2933+
Sender used by the ``Mailer``. Keep in mind that this setting override a sender set in the code.
2934+
2935+
recipients
2936+
""""""""""
2937+
2938+
**type**: ``array``
2939+
2940+
Recipients used by the ``Mailer``. Keep in mind that this setting override recipients set in the code.
2941+
2942+
..configuration-block::
2943+
2944+
..code-block::yaml
2945+
2946+
# config/packages/mailer.yaml
2947+
framework:
2948+
mailer:
2949+
dsn:'smtp://localhost:25'
2950+
envelope:
2951+
recipients:['admin@symfony.com', 'lead@symfony.com']
2952+
2953+
..code-block::xml
2954+
2955+
<!-- config/packages/mailer.xml-->
2956+
<?xml version="1.0" encoding="UTF-8" ?>
2957+
<containerxmlns="http://symfony.com/schema/dic/services"
2958+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2959+
xmlns:framework="http://symfony.com/schema/dic/symfony"
2960+
xsi:schemaLocation="http://symfony.com/schema/dic/services
2961+
https://symfony.com/schema/dic/services/services-1.0.xsd
2962+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
2963+
<framework:config>
2964+
<framework:mailerdsn="smtp://localhost:25">
2965+
<framework:envelope>
2966+
<framework:recipients>admin@symfony.com</framework:recipients>
2967+
<framework:recipients>lead@symfony.com</framework:recipients>
2968+
</framework:envelope>
2969+
</framework:mailer>
2970+
</framework:config>
2971+
</container>
2972+
2973+
..code-block::php
2974+
2975+
// config/packages/mailer.php
2976+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
2977+
return static function (ContainerConfigurator $containerConfigurator): void {
2978+
$containerConfigurator->extension('framework', [
2979+
'mailer' => [
2980+
'dsn' => 'smtp://localhost:25',
2981+
'envelope' => [
2982+
'recipients' => [
2983+
'admin@symfony.com',
2984+
'lead@symfony.com',
2985+
]
2986+
]
2987+
]
2988+
]);
2989+
};
2990+
2991+
.. _mailer-headers:
2992+
2993+
headers
2994+
.......
2995+
2996+
**type**: ``array``
2997+
2998+
Headers to add to emails. key (``name`` attribute in xml format)
2999+
is the header name and value the header value.
3000+
28913001
workflows
28923002
~~~~~~~~~
28933003

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp