Ejemplo n.º 1
0
 /**
  * Send a test email
  *
  * @param TBGRequest $request
  */
 public function runTestEmail(TBGRequest $request)
 {
     if ($email_to = $request->getParameter('test_email_to')) {
         try {
             if (TBGMailing::getModule()->sendTestEmail($email_to)) {
                 TBGContext::setMessage('module_message', TBGContext::getI18n()->__('The email was successfully accepted for delivery'));
             } else {
                 TBGContext::setMessage('module_error', TBGContext::getI18n()->__('The email was not sent'));
                 TBGContext::setMessage('module_error_details', TBGLogging::getMessagesForCategory('mailing', TBGLogging::LEVEL_NOTICE));
             }
         } catch (Exception $e) {
             TBGContext::setMessage('module_error', TBGContext::getI18n()->__('The email was not sent'));
             TBGContext::setMessage('module_error_details', $e->getMessage());
         }
     } else {
         TBGContext::setMessage('module_error', TBGContext::getI18n()->__('Please specify an email address'));
     }
     $this->forward(TBGContext::getRouting()->generate('configure_module', array('config_module' => 'mailing')));
 }