$context * * @throws TransportExceptionInterface */ public function send(string $emailCode, array $context): void { $email = null; foreach ($this->emailCollection->getEmails() as $appEmail) { /** @var EmailInterface $appEmail */ if ($appEmail->supports($emailCode)) { $email = $appEmail->getEmail($context); break; } } if ($email === null) { throw new \LogicException("No email found to process the $emailCode email"); } $configuration = $this->configurationRepository->getInstanceConfiguration(); Assert::isInstanceOf($configuration, Configuration::class); $from = new Address($configuration->getNotificationsSenderEmail(), $configuration->getNotificationsSenderName()); $email->from($from); $this->mailer->send($email); } }