@@ -27,15 +27,64 @@ over SMTP by configuring the DNS in your ``.env`` file (the ``user``,
27
27
# .env
28
28
MAILER_DSN=smtp://user:pass@smtp.example.com:port
29
29
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
+
30
68
.. caution ::
31
69
32
70
If you are migrating from Swiftmailer (and the Swiftmailer bundle), be
33
71
warned that the DSN format is different.
34
72
73
+ Using built-in transports
74
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
75
+
76
+ ============ ==================================== ===========
77
+ DSN protocol Example Description
78
+ ============ ==================================== ===========
79
+ smtp smtp://user:pass@smtp.example.com:25 Mailer use an SMTP server to send emails
80
+ sendmail sendmail://default Mailer use the local sendmail binary (`/usr/sbin/sendmail ` with `-bs ` options) to send emails
81
+ native native://default Mailer use 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
+
35
84
Using a 3rd Party Transport
36
85
~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
86
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
39
88
provider. Mailer supports several - install whichever you want:
40
89
41
90
================== =============================================
@@ -897,6 +946,8 @@ and it will select the appropriate certificate depending on the ``To`` option::
897
946
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
898
947
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
899
948
949
+ .. _multiple-email-transports :
950
+
900
951
Multiple Email Transports
901
952
-------------------------
902
953
0 commit comments