Example #1
0
 /**
  * @test
  *
  * @return void
  */
 public function testCanGetMailTo()
 {
     $this->assertEquals($this->fixture->getMailTo(), array('*****@*****.**' => 'John Doe'));
 }
 /**
  * action delete
  *
  * @param Subscriber $subscriber
  *
  * @throws InvalidArgumentValueException
  * @return void
  */
 public function deleteAction(Subscriber $subscriber = NULL)
 {
     $this->checkAuth();
     if ($subscriber === NULL) {
         throw new InvalidArgumentValueException('No subscriber given.');
     }
     // Check if the given subscriber is owned by authenticated user
     if ($subscriber->getEmail() !== $this->authentication->getEmail()) {
         throw new \InvalidArgumentException('Invalid subscriber given.');
     }
     $this->subscriberRepository->remove($subscriber);
     $this->persistEntities();
     $this->addFlashMessageByKey('deleted', FlashMessage::NOTICE);
     $this->redirect('list');
 }
 /**
  * Send optin mail for subscirber
  *
  * @param Subscriber $subscriber
  * @param Comment $comment Comment
  *
  * @return void
  */
 protected function sendOptInMail(Subscriber $subscriber, Comment $comment)
 {
     $this->log->dev('Send subscriber opt-in mail.');
     $post = $subscriber->getPost();
     $subscriber->updateAuth();
     $this->subscriberRepository->update($subscriber);
     $subject = $this->translate('subject.subscriber.new', $post->getTitle());
     $variables = array('post' => $post, 'comment' => $comment, 'subscriber' => $subscriber, 'subject' => $subject, 'validUntil' => $this->getValidUntil());
     $emailBody = $this->emailService->render($variables, 'SubscriberOptinMail.txt');
     $this->emailService->send($subscriber->getMailTo(), $this->settings['subscriptionManager']['subscriber']['mailFrom'], $subject, $emailBody);
 }