@@ -47,12 +47,12 @@ By default, the only transport available in the mailer component is Smtp.
47
47
48
48
Below is the list of other popular providers with built in support.
49
49
50
- - Amazon SES : symfony/amazon-mailer
51
- - Google Gmail : symfony/google-mailer
52
- - Mandrill : symfony/mailchimp-mailer
53
- - Mailgun : symfony/mailgun-mailer
54
- - Postmark : symfony/postmark-mailer
55
- - Sendgrid : symfony/sendgrid-mailer
50
+ - Amazon SES: `` symfony/amazon-mailer ``
51
+ - Google Gmail: `` symfony/google-mailer ``
52
+ - Mandrill: `` symfony/mailchimp-mailer ``
53
+ - Mailgun: `` symfony/mailgun-mailer ``
54
+ - Postmark: `` symfony/postmark-mailer ``
55
+ - Sendgrid: `` symfony/sendgrid-mailer ``
56
56
57
57
For example to use google's gmail as a transport you need to install symfony/google-mailer.
58
58
@@ -61,6 +61,7 @@ For example to use google's gmail as a transport you need to install symfony/goo
61
61
$ composer require symfony/google-mailer
62
62
63
63
.. code-block :: php
64
+
64
65
use Symfony\Component\Mailer\Bridge\Google\Smtp\GmailTransport;
65
66
66
67
$transport = new GmailTransport('user', 'pass');
@@ -78,12 +79,12 @@ The mailer component provides a convenient way to create transport object from d
78
79
79
80
Where ``$dns `` as one of the form below.
80
81
81
- - smtp://user:pass@gmail
82
- - smtp://key@sendgrid
83
- - smtp://null
84
- - smtp://user:pass@mailgun
85
- - http://key:domain@mailgun
86
- - api://id@postmark
82
+ - `` smtp://user:pass@gmail ``
83
+ - `` smtp://key@sendgrid ``
84
+ - `` smtp://null ``
85
+ - `` smtp://user:pass@mailgun ``
86
+ - `` http://key:domain@mailgun ``
87
+ - `` api://id@postmark ``
87
88
88
89
This provides a unified behaviour across all providers.
89
90
Easily switch from SMTP in dev to a "real" provider in production with same API.
@@ -108,15 +109,14 @@ If you want to send emails by using multiple transports in a round-robin fashion
108
109
Async
109
110
-----
110
111
111
- If you want to use the async functionality you need to install the `` messenger `` component.
112
+ If you want to use the async functionality you need to install the :doc: ` Messenger component < /components/messenger >` .
112
113
113
114
.. code-block :: terminal
114
115
115
116
$ composer require symfony/messenger
116
117
117
118
Then, instantiate and pass a ``MessageBus `` as a second argument to ``Mailer ``::
118
119
119
- .. code-block :: php
120
120
use Symfony\Component\Mailer\Mailer;
121
121
use Symfony\Component\Mailer\Messenger\MessageHandler;
122
122
use Symfony\Component\Mailer\Messenger\SendEmailMessage;
@@ -126,8 +126,9 @@ Then, instantiate and pass a ``MessageBus`` as a second argument to ``Mailer``::
126
126
use Symfony\Component\Messenger\MessageBus;
127
127
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
128
128
use Symfony\Component\Mime\Address;
129
-
130
- // .. $dsn = 'smtp://null';
129
+
130
+ $dsn = 'change-dsn-accordingly';
131
+
131
132
$transport = Transport::fromDsn($dsn);
132
133
$handler = new MessageHandler($transport);
133
134
0 commit comments