Пример #1
0
 public function doProcess(ContactInterface $contact)
 {
     $mailer = $this->container->get('mailer');
     $mail = \Swift_Message::newInstance()->setSubject('[Contact] ' . $contact->getSubject())->setFrom($contact->getSenderEmail(), $contact->getSenderName())->setTo($this->container->getParameter('ihqs_contact.email.recipients'))->setBody($contact->getMessage());
     $mailer->send($mail);
     return true;
 }
Пример #2
0
 public function doProcess(ContactInterface $contact)
 {
     $dir = $this->container->getParameter('kernel.root_dir') . '/logs';
     $line = array();
     array_push($line, $contact->getCreatedAt()->format('Y-m-d H:i:s'));
     array_push($line, $contact->getSenderEmail());
     array_push($line, $contact->getSenderName());
     array_push($line, $contact->getSubject());
     array_push($line, $contact->getMessage());
     file_put_contents($dir . '/contact.log', implode("\t", $line), FILE_APPEND);
     return true;
 }
Пример #3
0
 /**
  * checks if a contact request is spam
  *  
  * @param ContactInterface $contact
  * @return boolean
  */
 protected function isSpam(ContactInterface $contact)
 {
     return $this->spamDetector->isSpam(array('comment_author' => $contact->getSenderName(), 'comment_content' => $contact->getSubject()));
 }