Exemple #1
0
 /**
  *
  * @param string $psEmail
  * @param string $psPassword
  * @return boolean
  */
 public function sendPasswordByEmail($psEmail, $psPassword)
 {
     $loSendMail = new SendMail();
     try {
         $lsMsgH = sprintf(Translator::i18n("Sua senha para <b>%s</b> foi alterada. <br/> Sua nova senha é: <b>%s</b>"), $this->getRequest()->getServer('HTTP_ORIGIN'), $psPassword);
         $lsMsgT = sprintf(Translator::i18n("Sua senha para %s foi alterada. \n Sua nova senha é: %s"), $this->getRequest()->getServer('HTTP_ORIGIN'), $psPassword);
         $loSendMail->send(null, Translator::i18n('Sua senha foi alterada!'), array('text' => $lsMsgT, 'html' => $lsMsgH), $psEmail);
         $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'success', 'msg' => Translator::i18n('Sua nova senha foi enviada para seu e-mail de cadastro')));
         return true;
     } catch (Exception $e) {
         $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'warning', 'msg' => sprintf(Translator::i18n('Algo de errado aconteceu.<br/> %s'), $e->getMessage())));
         return false;
     }
 }
Exemple #2
0
 public function sendAction()
 {
     $this->_sLayout = 'Frontend';
     $this->_sWindowType = 'modal';
     $this->_sResponse = 'ajax';
     $this->_bPushMessage = true;
     $lsMsg = null;
     $loForm = Application::factory('ContactUs\\Form\\ContactUs2Form');
     $loForm->setForm();
     if ($this->requestIsPost()) {
         $loForm->setData($this->requestPost());
         if ($loForm->isValid()) {
             $laData = $loForm->getData();
             $laMsg = print_r($laData, true);
             $loSendMail = new SendMail();
             try {
                 $loSendMail->send(array($laData['fromMail'], $laData['fromName']), $laData['subject'], $laMsg);
                 $lsMsg = Translator::i18n('Sua mensagem foi enviada com sucesso.');
             } catch (Exception $e) {
                 $lsMsg = sprintf('<strong>%s</strong><br/> %s<br/>%s', Translator::i18n('Opa!'), Translator::i18n('Algo de errado aconteceu. Por favor, tente novamente mais tarde.'), $e->getMessage());
             }
         } else {
             Debug::display('not');
         }
     } else {
         Debug::display('nao');
     }
     $loView = new ViewModel(array('lsTitle' => $this->_sTitleS, 'lsRoute' => $this->_sRoute, 'loForm' => $loForm));
     return $this->setResponseType($loView, $lsMsg);
 }
Exemple #3
0
 /**
  * 
  * @param array $paPostData
  * @param array $paFileData
  * @param object $poForm
  * @param object $poEntity
  * @return boolean
  */
 public function addBeforeFlush($paPostData, $paFileData, $poForm, $poEntity)
 {
     $laOptions = Config::getAppOptions();
     $lsMsgH = sprintf(Translator::i18n("Suas credenciais de acesso a área restrita em <b>%s</b>. <br/> Seu login de acesso: <b>%s</b> <br/> Sua senha de acesso: <b>%s</b>"), $laOptions['url']['admin'], $paPostData['stUsername'], $paPostData['stPassword']);
     $lsMsgT = sprintf(Translator::i18n("Suas credenciais de acesso a área restrita em %s. \n Seu login de acesso: %s \n Sua senha de acesso: %s"), $laOptions['url']['admin'], $paPostData['stUsername'], $paPostData['stPassword']);
     $loSendMail = new SendMail();
     try {
         $loSendMail->send($laOptions['mail']['fromEmail'], Translator::i18n('Sua credenciais de acesso'), array('text' => $lsMsgT, 'html' => $lsMsgH), $paPostData['stEmail']);
         $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'success', 'msg' => Translator::i18n('Sua nova senha foi enviada para seu e-mail de cadastro')));
         return true;
     } catch (\Exception $e) {
         $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'warning', 'msg' => sprintf(Translator::i18n('Algo de errado aconteceu.<br/> %s'), $e->getMessage())));
         return false;
     }
 }
 public function sendConfirmationEmail($poUser)
 {
     $loSendMail = new SendMail();
     try {
         $laMsg = "Please, click the link to confirm your registration => " . $this->getRequest()->getServer('HTTP_ORIGIN') . $this->url()->fromRoute('Access/default', array('controller' => 'registration', 'action' => 'confirm-email', 'id' => $poUser->getRegistrationToken()));
         $loSendMail->send(null, 'Por favor, confirme seu registro!', $laMsg, $poUser->getEmail());
         $laMessage['success'] = true;
         $laMessage['msg'] = "<strong>Success!</strong><br/> The message was sent successfully.";
     } catch (Exception $e) {
         $laMessage['success'] = false;
         $laMessage['msg'] = '<strong>Ops!</strong><br/> Something wrong has happened. Please, try again later.<br/>' . $e->getMessage();
     }
 }
 public function sendMail($paTo, $paMsg)
 {
     $loForm = Application::factory($this->_sForm);
     $loSendMail = new SendMail();
     try {
         $loSendMail->send(null, Translator::i18n('Acesso '), $paMsg, $paTo);
         $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'success', 'msg' => sprintf("<strong>%s</strong><br/> %s", Translator::i18n('Success!'), Translator::i18n('The message was sent successfully.'))));
     } catch (Exception $e) {
         $this->flashMessenger()->addMessage(array('id' => $this->get('_sModule') . '-' . microtime(true), 'hidden' => $this->get('_bHiddenPushMessage'), 'push' => $this->get('_bPushMessage'), 'type' => 'error', 'msg' => sprintf('<strong>%s</strong><br/> %s<br/>%s', Translator::i18n('Ops!'), Translator::i18n('Something wrong has happened. Please, try again later.'), $e->getMessage())));
     }
 }