feat: send emails async via messenger
This commit is contained in:
@@ -16,7 +16,7 @@ framework:
|
||||
sync: 'sync://'
|
||||
|
||||
routing:
|
||||
Symfony\Component\Mailer\Messenger\SendEmailMessage: sync
|
||||
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
|
||||
Symfony\Component\Notifier\Message\ChatMessage: async
|
||||
Symfony\Component\Notifier\Message\SmsMessage: async
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\Mime\BodyRendererInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
@@ -15,6 +16,7 @@ class Mailer
|
||||
{
|
||||
public function __construct(
|
||||
private readonly MailerInterface $mailer,
|
||||
private readonly BodyRendererInterface $bodyRenderer,
|
||||
private readonly TranslatorInterface $translator,
|
||||
private readonly array $defaults,
|
||||
private readonly LoggerInterface $logger
|
||||
@@ -48,6 +50,8 @@ class Mailer
|
||||
$email->attach($attachment->getContent(), $attachment->getName(), $attachment->getMimeType());
|
||||
}
|
||||
|
||||
$this->bodyRenderer->render($email);
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user