private function buildMessage(Contact $contact)
 {
     $message = \Swift_Message::newInstance()->setTo($contact->getRecipient())->setFrom($contact->getSenderEmailAddress(), $contact->getSenderName())->setSubject($contact->getSubject())->setBody($contact->getMessage());
     return $message;
 }
Exemplo n.º 2
0
 /**
  * @param Contact $contact
  */
 public function send(Contact $contact)
 {
     $title = $this->translator->trans('You have a new message from %from%', ['%from%' => $contact->getFrom()]);
     $message = Swift_Message::newInstance($title, $contact->getMessage())->setFrom($this->senderEmail)->setTo($this->recipientEmail)->setReplyTo($this->recipientEmail)->setBody($this->templating->render('/mail/contact.html.twig', ['contact' => $contact]));
     $this->mailer->send($message);
 }