/**
  * Closed at production environment, available at development
  */
 public function emailAction()
 {
     $this->_develOnly();
     $data = $this->_helper->requestData();
     $mail = new App_Mail();
     $mail->setViewScript('welcome');
     $mail->addTo($data['mail'], $data['name']);
     try {
         $mail->send();
     } catch (Exception $e) {
         App::log($e, Zend_Log::CRIT);
     }
 }
 protected function _createMail(UserModel $user, $brand = null)
 {
     if (\App::get('mail') === null) {
         throw new UnexpectedException('No mail transport configured');
     }
     $fullName = $user->getFirstName() . ' ' . $user->getLastName();
     // Creating / configuring email object.
     $mail = new \App_Mail('UTF-8');
     $mail->setLocale($user->getLanguage());
     $mail->addTo($user->getEmail(), $fullName);
     $view = $mail->getView();
     $view->fullName = $fullName;
     $view->userName = $user->userName;
     $view->user = $user;
     // Configure brand mail folder
     if (!$brand || !$brand instanceof BrandModel) {
         $brandService = BrandService::getInstance();
         $brand = $brandService->loadByUser($user);
     }
     if (!$brand || !$brand instanceof BrandModel) {
         throw new NotFoundException("Brand not found for user " . $user->id);
     }
     $mail->setScriptNamespace($brand->getScriptNamespace());
     $view->setBaseUrl($brand->getEndPoint());
     $view->setImageNamespace($brand->getImageNamespace());
     $view->brand = $brand;
     \App::log()->debug("Sending an email using '" . $brand->brand . "' brand");
     return $mail;
 }