Esempio n. 1
0
 private function sendConfirmMail(Configuration $configuration, ContactInterface $model)
 {
     $text = $this->templating->render($configuration->getConfirmTemplate(), ['data' => $model]);
     $subject = $this->translator->trans($configuration->getSubject(), [], $configuration->getTranslationDomain());
     $message = \Swift_Message::newInstance()->setSubject($subject)->setFrom($configuration->getFrom())->setTo($model->getEmail())->setBody($text, 'text/html');
     $this->mailer->send($message);
 }
Esempio n. 2
0
 /**
  * Create configuration
  *
  * @param $name
  * @return Configuration
  */
 public function create($name)
 {
     $this->checkName($name);
     $configuration = new Configuration();
     $configuration->setName($name);
     $configuration->setModel($this->getParameter($name, 'model'));
     $configuration->setForm($this->getParameter($name, 'form'));
     $configuration->setFormTemplate($this->getParameter($name, 'template.form'));
     $configuration->setRecipientTemplate($this->getParameter($name, 'template.recipient'));
     $configuration->setConfirmTemplate($this->getParameter($name, 'template.confirm'));
     $configuration->setFrom($this->getParameter($name, 'from'));
     $configuration->setSubject($this->getParameter($name, 'subject'));
     $configuration->setTranslationDomain($this->getParameter($name, 'translation_domain'));
     $configuration->setConfirmMail($this->getParameter($name, 'confirm_mail'));
     $configuration->setFormName($this->resolveFormName($name));
     return $configuration;
 }