transport = $mailjetTransport ; $this->templating = $templating ; $this->parameterBag = $parameterBag ; } public function send($params = []) { $message = new \Swift_Message($params[self::SUBJECT]); $message->addTo( $params[self::TO_EMAIL], isset($params[self::TO_NAME]) ? $params[self::TO_NAME] : null) ->addFrom( isset($params[self::FROM_EMAIL]) ? $params[self::FROM_EMAIL] : $this->parameterBag->get('app.noreply_email'), isset($params[self::FROM_NAME]) ? $params[self::FROM_NAME] : $this->parameterBag->get('app.site_name')) ->setBody($this->templating->render($params[self::CONTENT_TEMPLATE].'-html.html.twig', $params[self::CONTENT_DATA]), 'text/html') ->addPart($this->templating->render($params[self::CONTENT_TEMPLATE].'-text.html.twig', $params[self::CONTENT_DATA])) ; $this->transport->send($message) ; } }