setupSMTP() public static method

public static setupSMTP ( PHPMailer &$phpMailer )
$phpMailer PHPMailer
コード例 #1
0
 public static function createCustomer($instance)
 {
     $originalSiteAccess = erLhcoreClassSystem::instance()->SiteAccess;
     if ($instance->locale != '') {
         erLhcoreClassSystem::instance()->setSiteAccessByLocale($instance->locale);
     }
     $password = erLhcoreClassModelForgotPassword::randomPassword(10);
     $chat_box_hash = erLhcoreClassModelForgotPassword::randomPassword(10);
     $searchArray = array('{email_replace}', '{password_hash}', '{export_hash_chats}', '{chat_box_hash}', '{chat_box_hash_length}');
     $cfg = erConfigClassLhConfig::getInstance();
     $replaceArray = array($instance->email, sha1($password . $cfg->getSetting('site', 'secrethash') . sha1($password)), erLhcoreClassModelForgotPassword::randomPassword(10), $chat_box_hash, strlen($chat_box_hash));
     $db = ezcDbInstance::get();
     self::deleteDatabase($instance->id);
     self::createDatabase($instance->id);
     $db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . $instance->id);
     $sql = file_get_contents('extension/instance/doc/db_3.sql');
     $sql = str_replace($searchArray, $replaceArray, $sql);
     $db->query($sql);
     $dbPostUpdate = ltrim(erLhcoreClassDesign::design('db_post_update/db.sql'), '/');
     if (file_exists($dbPostUpdate)) {
         $db->query(file_get_contents($dbPostUpdate));
     }
     // Insert default user language
     if ($instance->locale != '') {
         $stm = $db->prepare("INSERT INTO `lh_users_setting` (`user_id`, `identifier`, `value`) VALUES (1,'user_language',:value)");
         $stm->bindValue(':value', $instance->locale);
         $stm->execute();
     } else {
         $stm = $db->prepare("INSERT INTO `lh_users_setting` (`user_id`, `identifier`, `value`) VALUES (1,'user_language',:value)");
         $stm->bindValue(':value', 'en_EN');
         $stm->execute();
     }
     $tpl = erLhcoreClassTemplate::getInstance('lhinstance/email.tpl.php');
     $tpl->setArray(array('instance' => $instance, 'email' => $instance->email, 'password' => $password));
     $mail = new PHPMailer();
     $mail->CharSet = 'UTF-8';
     $mail->Sender = $mail->From = $cfg->getSetting('site', 'seller_mail');
     $mail->FromName = $cfg->getSetting('site', 'seller_title');
     $mail->Subject = $cfg->getSetting('site', 'seller_title');
     $mail->AddReplyTo($cfg->getSetting('site', 'seller_mail'), $cfg->getSetting('site', 'seller_title'));
     $mail->Body = $tpl->fetch();
     $mail->AddAddress($instance->email);
     erLhcoreClassChatMail::setupSMTP($mail);
     $mail->Send();
     $mail->ClearAddresses();
     // Dispatch event for listeners
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.registered.created', array('instance' => $instance));
     $db->query('USE ' . $cfg->getSetting('db', 'database'));
     // Activate instance
     $sql = "UPDATE lhc_instance_client SET status = 1 WHERE id = {$instance->id}";
     $db->query($sql);
     if ($instance->locale != '') {
         erLhcoreClassSystem::instance()->setSiteAccess($originalSiteAccess);
     }
 }
コード例 #2
0
 public function addSMSMessageSend($number)
 {
     $this->sms_left -= $number;
     $this->sms_processed += $number;
     if ($this->soft_limit_in_effect == true && $this->soft_warning_send == 0) {
         $this->soft_warning_send = 1;
         // Send mail to global administrator
         $mail = new PHPMailer(true);
         $mail->CharSet = "UTF-8";
         $mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instance has reached soft SMS limit') . ' - ' . $this->id;
         $mail->AddReplyTo($this->email, (string) $this->address);
         $tpl = new erLhcoreClassTemplate();
         $tpl->set('instance', $this);
         // Remove new line characters
         $content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_soft_limit.tpl.php'));
         // Replace br with new line characters
         $content = str_replace("<br/>", "\n", $content);
         $mail->Body = $content;
         $mail->AddAddress(erConfigClassLhConfig::getInstance()->getSetting('site', 'support_mail'));
         erLhcoreClassChatMail::setupSMTP($mail);
         try {
             $mail->Send();
         } catch (Exception $e) {
         }
         $mail->ClearAddresses();
         // Send mail to instance admin
         $mail = new PHPMailer(true);
         $mail->CharSet = "UTF-8";
         $mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'You have reached soft SMS limit');
         $mail->AddReplyTo($this->email, (string) $this->address);
         $tpl = new erLhcoreClassTemplate();
         $tpl->set('instance', $this);
         // Remove new line characters
         $content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_soft_limit_user.tpl.php'));
         // Replace br with new line characters
         $content = str_replace("<br/>", "\n", $content);
         $mail->Body = $content;
         $mail->AddAddress($this->email);
         erLhcoreClassChatMail::setupSMTP($mail);
         try {
             $mail->Send();
         } catch (Exception $e) {
         }
         $mail->ClearAddresses();
     }
     if ($this->hard_limit_in_effect == true && $this->hard_warning_send == 0) {
         $this->hard_warning_send = 1;
         // Send mail to global administrator
         $mail = new PHPMailer(true);
         $mail->CharSet = "UTF-8";
         $mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'Instance has reached hard SMS limit') . ' - ' . $this->id;
         $mail->AddReplyTo($this->email, (string) $this->address);
         $tpl = new erLhcoreClassTemplate();
         $tpl->set('instance', $this);
         // Remove new line characters
         $content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_hard_limit.tpl.php'));
         // Replace br with new line characters
         $content = str_replace("<br/>", "\n", $content);
         $mail->Body = $content;
         $mail->AddAddress(erConfigClassLhConfig::getInstance()->getSetting('site', 'support_mail'));
         erLhcoreClassChatMail::setupSMTP($mail);
         try {
             $mail->Send();
         } catch (Exception $e) {
         }
         $mail->ClearAddresses();
         // Send mail to instance admin
         $mail = new PHPMailer(true);
         $mail->CharSet = "UTF-8";
         $mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('instance/edit', 'You have reached hard SMS limit');
         $mail->AddReplyTo($this->email, (string) $this->address);
         $tpl = new erLhcoreClassTemplate();
         $tpl->set('instance', $this);
         // Remove new line characters
         $content = str_replace("\n", "", $tpl->fetch('lhinstance/mail/phone_hard_limit_user.tpl.php'));
         // Replace br with new line characters
         $content = str_replace("<br/>", "\n", $content);
         $mail->Body = $content;
         $mail->AddAddress($this->email);
         erLhcoreClassChatMail::setupSMTP($mail);
         try {
             $mail->Send();
         } catch (Exception $e) {
         }
         $mail->ClearAddresses();
     }
     $this->saveToInstanceThis();
 }
コード例 #3
0
            $host = $_SERVER['HTTP_HOST'];
            $adminEmail = erConfigClassLhConfig::getInstance()->getSetting('site', 'site_admin_email');
            $UserData = erLhcoreClassUser::getSession()->load('erLhcoreClassModelUser', $userID);
            $hash = erLhcoreClassModelForgotPassword::randomPassword(40);
            erLhcoreClassModelForgotPassword::setRemindHash($UserData->id, $hash);
            $mail = new PHPMailer();
            $mail->CharSet = "UTF-8";
            $mail->From = $adminEmail;
            $mail->FromName = erConfigClassLhConfig::getInstance()->getSetting('site', 'title');
            $mail->Subject = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Password remind');
            // HTML body
            $body = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Click this link and You will be sent a new password') . ' </br><a href="http://' . $host . erLhcoreClassDesign::baseurl('user/remindpassword') . '/' . $hash . '">Restore password</a>';
            // Plain text body
            $text_body = erTranslationClassLhTranslation::getInstance()->getTranslation('user/forgotpassword', 'Click this link and You will be sent a new password') . ' - http://' . $host . erLhcoreClassDesign::baseurl('user/remindpassword') . '/' . $hash;
            $mail->Body = $body;
            $mail->AltBody = $text_body;
            $mail->AddAddress($UserData->email, $UserData->username);
            erLhcoreClassChatMail::setupSMTP($mail);
            $mail->Send();
            $mail->ClearAddresses();
            $tpl = erLhcoreClassTemplate::getInstance('lhuser/forgotpasswordsent.tpl.php');
        } else {
            erLhcoreClassModule::redirect('user/forgotpassword');
            exit;
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
$Result['content'] = $tpl->fetch();
$Result['pagelayout'] = 'login';
コード例 #4
0
 /**
  * Sends expire mail
  */
 public static function sendExpireMail(erLhcoreClassModelInstance $instance, $expireOption)
 {
     $cfg = erConfigClassLhConfig::getInstance();
     $originalSiteAccess = erLhcoreClassSystem::instance()->SiteAccess;
     if ($instance->locale != '') {
         erLhcoreClassSystem::instance()->setSiteAccessByLocale($instance->locale);
     }
     $tpl = erLhcoreClassTemplate::getInstance('lhinstance/expire_options_mails/' . $expireOption['template']);
     $tpl->setArray(array('instance' => $instance, 'email' => $instance->email, 'client_attributes_array' => $instance->client_attributes_array));
     $mail = new PHPMailer();
     $mail->CharSet = 'UTF-8';
     $mail->Sender = $mail->From = $cfg->getSetting('site', 'seller_mail');
     $mail->FromName = $cfg->getSetting('site', 'seller_title');
     $mail->Subject = $expireOption['mail']['subject'];
     $mail->AddReplyTo($cfg->getSetting('site', 'seller_mail'), $cfg->getSetting('site', 'seller_title'));
     $mail->Body = $tpl->fetch();
     $mail->AddAddress($instance->email);
     erLhcoreClassChatMail::setupSMTP($mail);
     $mail->Send();
     $mail->ClearAddresses();
 }