Skip to content

Commit b212f63

Browse files
committed
Add built-in protocols (smtp, sendmail) + the new one (native)
1 parent 53f7dc6 commit b212f63

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

mailer.rst

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

3270
If you are migrating from Swiftmailer (and the Swiftmailer bundle), be
3371
warned that the DSN format is different.
3472

73+
Using built-in transports
74+
~~~~~~~~~~~~~~~~~~~~~~~~~
75+
76+
============ ==================================== ===========
77+
DSN protocol Example Description
78+
============ ==================================== ===========
79+
smtp smtp://user:[email protected]:25 Mailer uses an SMTP server to send emails
80+
sendmail sendmail://default Mailer uses the local sendmail binary (`/usr/sbin/sendmail` with `-bs` options) to send emails
81+
native native://default Mailer uses the sendmail binary and options configured in the `sendmail_path` setting of `php.ini`. On Windows hosts, Mailer fallbacks to `smtp` and `smtp_port` `php.ini` settings when `sendmail_path` is not configured.
82+
============ ==================================== ===========
83+
3584
Using a 3rd Party Transport
3685
~~~~~~~~~~~~~~~~~~~~~~~~~~~
3786

38-
Instead of using your own SMTP server, you can send emails via a 3rd party
87+
Instead of using your own SMTP server or sendmail binary, you can send emails via a 3rd party
3988
provider. Mailer supports several - install whichever you want:
4089

4190
================== ==============================================
@@ -902,6 +951,8 @@ and it will select the appropriate certificate depending on the ``To`` option::
902951
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
903952
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
904953

954+
.. _multiple-email-transports:
955+
905956
Multiple Email Transports
906957
-------------------------
907958

0 commit comments

Comments
 (0)