/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('email', EmailType::class, ['required' => true, 'label' => 'lbl.Email', 'attr' => ['placeholder' => ucfirst(Language::lbl('YourEmail'))]]); if (!empty($this->interests)) { $builder->add('interests', ChoiceType::class, ['choices' => $this->interests, 'expanded' => true, 'multiple' => true]); } $builder->add('subscribe', SubmitType::class, ['label' => 'lbl.Subscribe']); }
/** * On NotImplementedUnsubscribedEvent * * @param NotImplementedUnsubscribedEvent $event */ public function onNotImplementedUnsubscribedEvent(NotImplementedUnsubscribedEvent $event) { // define title $title = sprintf(Language::lbl('MailTitleUnsubscribeSubscriber'), $event->getUnsubscription()->email, strtoupper($event->getUnsubscription()->language)); // define sender/receiver(s) $to = $this->modulesSettings->get('Core', 'mailer_to'); $from = $this->modulesSettings->get('Core', 'mailer_from'); $replyTo = $this->modulesSettings->get('Core', 'mailer_reply_to'); // define message $message = Message::newInstance($title)->setFrom(array($from['email'] => $from['name']))->setTo(array($to['email'] => $to['name']))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml(FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.html.twig', array('message' => $title), true); // send mail $this->mailer->send($message); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('email', EmailType::class, ['required' => true, 'label' => 'lbl.Email', 'attr' => ['placeholder' => ucfirst(Language::lbl('YourEmail'))]])->add('unsubscribe', SubmitType::class, ['label' => 'lbl.Unsubscribe']); }
/** * Get mail engines. * * @return array */ private function getPossibleMailEngines() { // init dropdown values $ddmValuesForMailEngines = array(); // Add empty one $ddmValuesForMailEngines['not_implemented'] = ucfirst(Language::lbl('None')); // loop all container services to find "mail-engine" gateway services foreach ($this->serviceIds as $serviceId) { // the pattern to find mail engines $pattern = '/^mailmotor.(?P<mailengine>\\w+).subscriber.gateway/'; $matches = array(); // we found a mail-engine gateway service if (preg_match($pattern, $serviceId, $matches)) { // we skip the fallback gateway if ($matches['mailengine'] == 'not_implemented') { continue; } // add mailengine to dropdown values $ddmValuesForMailEngines[$matches['mailengine']] = ucfirst($matches['mailengine']); } } return $ddmValuesForMailEngines; }