/** * @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; }
/** * @param Notification $notification * @param Ticket $ticket * @param bool $isOroUser * @param string $recipientEmail * @param $changeList * * @return \Swift_Message */ private function message(Notification $notification, Ticket $ticket, $isOroUser, $recipientEmail, $changeList) { $senderEmail = $this->configManager->get(self::EMAIL_NOTIFIER_CONFIG_PATH); $userFormattedName = $this->getFormattedUserName($notification, $ticket); /** @var \Swift_Message $message */ $message = $this->mailer->createMessage(); $message->setSubject($this->decorateMessageSubject($notification->getSubject(), $ticket)); $message->setFrom($senderEmail, $userFormattedName); $message->setTo($recipientEmail); $message->setReplyTo($senderEmail); $headers = $message->getHeaders(); $headers->addTextHeader('In-Reply-To', $this->inReplyToHeader($notification)); $headers->addIdHeader('References', $this->referencesHeader($ticket)); $options = array('changes' => $changeList, 'attachments' => $notification->getAttachments(), 'user' => $userFormattedName, 'header' => $notification->getHeaderText(), 'delimiter' => MessageReferenceServiceImpl::DELIMITER_LINE, 'isOroUser' => $isOroUser, 'ticketKey' => $ticket->getKey()); $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; }