minor #41403 [Mailer] Fix typo in README (W0rma)
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Mailer] Fix typo in README
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
14f2a2974c
[Mailer] Fix typo in README
This commit is contained in:
commit
11a88370e3
@ -36,16 +36,20 @@ set up the `BodyRenderer`:
|
|||||||
|
|
||||||
```php
|
```php
|
||||||
use Symfony\Bridge\Twig\Mime\BodyRenderer;
|
use Symfony\Bridge\Twig\Mime\BodyRenderer;
|
||||||
|
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
use Symfony\Component\Mailer\EventListener\MessageListener;
|
use Symfony\Component\Mailer\EventListener\MessageListener;
|
||||||
|
use Symfony\Component\Mailer\Mailer;
|
||||||
|
use Symfony\Component\Mailer\Transport;
|
||||||
use Twig\Environment as TwigEnvironment;
|
use Twig\Environment as TwigEnvironment;
|
||||||
|
|
||||||
$twig = new TwigEnvironment(...);
|
$twig = new TwigEnvironment(...);
|
||||||
$messageListener = new MessageListener(new BodyRenderer($twig));
|
$messageListener = new MessageListener(null, new BodyRenderer($twig));
|
||||||
|
|
||||||
$eventDispatcher = new EventDispatcher();
|
$eventDispatcher = new EventDispatcher();
|
||||||
$eventDispatcher->addSubscriber($messageListener);
|
$eventDispatcher->addSubscriber($messageListener);
|
||||||
|
|
||||||
|
$transport = Transport::fromDsn('smtp://localhost', $eventDispatcher);
|
||||||
$mailer = new Mailer($transport, null, $eventDispatcher);
|
$mailer = new Mailer($transport, null, $eventDispatcher);
|
||||||
|
|
||||||
$email = (new TemplatedEmail())
|
$email = (new TemplatedEmail())
|
||||||
@ -56,7 +60,7 @@ $email = (new TemplatedEmail())
|
|||||||
'username' => 'foo',
|
'username' => 'foo',
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
$mailer->mail($email);
|
$mailer->send($email);
|
||||||
```
|
```
|
||||||
|
|
||||||
Resources
|
Resources
|
||||||
|
Reference in New Issue
Block a user