/** * Send email * @param sfEvent $event */ public function listenToMessagingEvent(sfEvent $event) { $mailer = new sfPlopMessaging($event['options']); $mailer->sendEmail($event['mailer']); }
/** * Function which aims to bind a contact form without rendering the view * @param sfWebRequest $request */ public function executeContact(sfWebRequest $request) { $user = $this->getUser(); $isAjax = $request->isXmlHttpRequest(); $referer = $request->getParameter('r'); if ($request->getMethod() == sfRequest::POST) { $slot = sfPlopSlotConfigPeer::retrieveByPk($request->getParameter('c')); $form = new sfPlopPublicContactForm(null, array('contact' => $slot ? $slot->getOption('contact', null, $this->culture) : null)); $form->bind($request->getParameter('contact')); $user->setAttribute('contactForm_valid', false); $user->setAttribute('contactForm_form', $form); if ($form->isValid()) { $mailer = new sfPlopMessaging($form->getValues()); $return = $mailer->sendEmail($this->getMailer()); if ($return['count'] == $return['sent']) { // { $user->setAttribute('contactForm_valid', true); } // } // else // { // } } // else // { // $user->setAttribute('contactForm_valid', false); // $user->setAttribute('contactForm_form', $form); // } } return $this->redirect('@sf_plop_page_show?slug=' . $referer); }