[Mailer] Fix typo in README
This commit is contained in:
parent
427cf6982e
commit
14f2a2974c
@ -36,16 +36,20 @@ set up the `BodyRenderer`:
|
||||
|
||||
```php
|
||||
use Symfony\Bridge\Twig\Mime\BodyRenderer;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\Mailer\EventListener\MessageListener;
|
||||
use Symfony\Component\Mailer\Mailer;
|
||||
use Symfony\Component\Mailer\Transport;
|
||||
use Twig\Environment as TwigEnvironment;
|
||||
|
||||
$twig = new TwigEnvironment(...);
|
||||
$messageListener = new MessageListener(new BodyRenderer($twig));
|
||||
$messageListener = new MessageListener(null, new BodyRenderer($twig));
|
||||
|
||||
$eventDispatcher = new EventDispatcher();
|
||||
$eventDispatcher->addSubscriber($messageListener);
|
||||
|
||||
$transport = Transport::fromDsn('smtp://localhost', $eventDispatcher);
|
||||
$mailer = new Mailer($transport, null, $eventDispatcher);
|
||||
|
||||
$email = (new TemplatedEmail())
|
||||
@ -56,7 +60,7 @@ $email = (new TemplatedEmail())
|
||||
'username' => 'foo',
|
||||
])
|
||||
;
|
||||
$mailer->mail($email);
|
||||
$mailer->send($email);
|
||||
```
|
||||
|
||||
Resources
|
||||
|
Reference in New Issue
Block a user