/** * {@inheritdoc} */ public function sendNotification(Notification $notification) { $to = json_decode($notification->getTo(), true); $content = json_decode($notification->getContent(), true); $configuration = $this->getConfiguration($notification); $message = \Swift_Message::newInstance()->setSubject(isset($content['subject']) ? $content['subject'] : null)->setFrom(array($configuration['from'] => $configuration['fromName']))->setReplyTo(isset($configuration['replyTo']) ? $configuration['replyTo'] : null)->setTo($to['to'])->setCc(isset($to['cc']) ? $to['cc'] : null)->setBcc(isset($to['bcc']) ? $to['bcc'] : null)->setBody(isset($content['message']) ? $content['message'] : null); if ($content['htmlMessage']) { $message->addPart($content['htmlMessage'], 'text/html'); } $mailer = $this->getMailer($configuration); return $mailer->send($message) > 0; }
/** * @dataProvider getProvidedData */ public function testGetContentDecoded(Notification $emailNotification) { $this->assertEquals(json_decode($emailNotification->getContent(), true), $emailNotification->getContentDecoded()); }