public function execute($request) { $emailConfigurationService = new EmailConfigurationService(); $this->form = new EmailConfigurationForm(array(), array(), true); $this->form->bind($request->getParameter($this->form->getName())); $emailConfiguration = $this->form->populateEmailConfiguration($request); $emailConfigurationService->saveEmailConfiguration($emailConfiguration); if ($request->getParameter('chkSendTestEmail')) { $emailService = new EmailService(); $result = $emailService->sendTestEmail($request->getParameter('txtTestEmail')); if ($result) { $this->getUser()->setFlash('templateMessage', array('SUCCESS', __('Successfully Saved. Test Email Sent'))); } else { $this->getUser()->setFlash('templateMessage', array('WARNING', __("Successfully Saved. Test Email Not Sent"))); } } else { $this->getUser()->setFlash('templateMessage', array('SUCCESS', __(TopLevelMessages::SAVE_SUCCESS))); } $this->redirect('admin/listMailConfiguration'); }