Exemplo n.º 1
0
 function log($msg, $level = GLZ_LOG_DEBUG, $group = '')
 {
     if (!$this->_check($level, $group)) {
         return false;
     }
     if (is_array($msg) || is_object($msg)) {
         $msg = json_encode($msg);
     }
     org_glizy_helpers_Mail::sendEmail(array('email' => $this->destEmail, 'name' => $this->destEmail), array('email' => org_glizy_Config::get('SMTP_EMAIL'), 'name' => org_glizy_Config::get('SMTP_SENDER')), $this->mailTitle, str_replace("\t", "<br />", $this->_format($msg, $level, $group)));
     return true;
 }
Exemplo n.º 2
0
 public function executeLater($email)
 {
     if ($this->submit && $this->controller->validate()) {
         $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User');
         if (!$ar->find(array('user_email' => $email))) {
             // utente non trovato
             $this->view->validateAddError(__T('MW_LOSTPASSWORD_ERROR'));
             return false;
         }
         // utente trovato
         // genera una nuova password e la invia per email
         glz_import('org.glizy.helpers.Mail');
         // invia la notifica all'utente
         $subject = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_SUBJECT');
         $body = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_BODY');
         $body = str_replace('##USER##', $email, $body);
         $body = str_replace('##HOST##', org_glizy_helpers_Link::makeSimpleLink(GLZ_HOST, GLZ_HOST), $body);
         $body = str_replace('##PASSWORD##', $ar->user_password, $body);
         org_glizy_helpers_Mail::sendEmail(array('email' => org_glizy_Request::get('email', ''), 'name' => $ar->user_firstName . ' ' . $ar->user_lastName), array('email' => org_glizy_Config::get('SMTP_EMAIL'), 'name' => org_glizy_Config::get('SMTP_SENDER')), $subject, $body);
         $this->changeAction('lostPasswordConfirm');
     }
 }
Exemplo n.º 3
0
 /**
  * @param string $fileName
  * @param array $info
  * @param string $htmlTemplateHeader
  * @param string $htmlTemplateFooter
  * @param string $templatePath
  * @return array
  */
 static function sendEmailFromTemplate($fileName, $info, $htmlTemplateHeader = '', $htmlTemplateFooter = '', $templatePath = '')
 {
     /** @var org_glizy_application_Application $application */
     $application = org_glizy_ObjectValues::get('org.glizy', 'application');
     $templatePath = $templatePath ? $templatePath : __Paths::get('APPLICATION_STATIC') . '/templatesEmail/' . $application->getLanguage() . '/';
     $emailText = file_get_contents($templatePath . $fileName . '.txt');
     $emailText = explode("\n", $emailText);
     $emailTitle = array_shift($emailText);
     $emailBody = implode("\n<br />", $emailText);
     foreach ($info as $k => $v) {
         $emailBody = str_replace('##' . $k . '##', $v, $emailBody);
         $emailTitle = str_replace('##' . $k . '##', $v, $emailTitle);
     }
     if ($htmlTemplateHeader && $htmlTemplateFooter) {
         $emailBody = file_get_contents($templatePath . $htmlTemplateHeader) . $emailBody . file_get_contents($templatePath . $htmlTemplateFooter);
     }
     return org_glizy_helpers_Mail::sendEmail(array('email' => $info['EMAIL'], 'name' => $info['FIRST_NAME'] . ' ' . $info['LAST_NAME']), array('email' => org_glizy_Config::get('SMTP_EMAIL'), 'name' => org_glizy_Config::get('SMTP_SENDER')), $emailTitle, $emailBody, $info['ATTACHS'], $info['CC'], $info['BCC']);
 }