/** * @param Notification $notification * * @return \Swift_Message */ private function message(Notification $notification) { /** @var \Swift_Message $message */ $message = $this->mailer->createMessage(); $message->setSubject(ucfirst($notification->getHeaderText())); $senderName = $this->configManager->get('oro_notification.email_notification_sender_name'); $message->setFrom($this->senderEmail, $senderName); $mail = $notification->getAuthor()->getEmail(); $message->setTo($mail); $options = array('user' => $this->getFormattedUserName($notification), 'header' => $notification->getHeaderText()); $txtTemplate = $this->templateResolver->resolve($notification, TemplateResolver::TYPE_TXT); $htmlTemplate = $this->templateResolver->resolve($notification, TemplateResolver::TYPE_HTML); $message->setBody($this->twig->render($txtTemplate, $options), 'text/plain'); $message->addPart($this->twig->render($htmlTemplate, $options), 'text/html'); return $message; }