From bd2e12c36ade347e01bab568b92f1a8352955ead Mon Sep 17 00:00:00 2001 From: Dumazeau Date: Thu, 19 Jan 2023 08:50:10 +0100 Subject: [PATCH] Change MessageEventSubscriber logic --- .../EventSubscriber/MessageEventSubscriber.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Infrastructure/EventSubscriber/MessageEventSubscriber.php b/src/Infrastructure/EventSubscriber/MessageEventSubscriber.php index ce63814..e29dee3 100644 --- a/src/Infrastructure/EventSubscriber/MessageEventSubscriber.php +++ b/src/Infrastructure/EventSubscriber/MessageEventSubscriber.php @@ -18,8 +18,6 @@ class MessageEventSubscriber implements EventSubscriberInterface { - public const ALREADY_UPDATE_HEADER_KEY = 'mailer-bundle-update'; - #[Required] public BccEmailUpdater $bccEmailUpdater; @@ -45,16 +43,10 @@ public function onMessage(MessageEvent $event): void { $message = $event->getMessage(); - if (!$message instanceof Email) { + if (!$message instanceof Email || $event->isQueued()) { return; } - if ($message->getHeaders()->has(self::ALREADY_UPDATE_HEADER_KEY)) { - return; - } - - $message->getHeaders()->addTextHeader(self::ALREADY_UPDATE_HEADER_KEY, 'true'); - ($this->bccEmailUpdater)($message); ($this->footerEmailUpdater)($message); ($this->returnPathEmailUpdater)($message);