當前位置: 首頁>>代碼示例>>PHP>>正文


PHP email::email_sock方法代碼示例

本文整理匯總了PHP中email::email_sock方法的典型用法代碼示例。如果您正苦於以下問題:PHP email::email_sock方法的具體用法?PHP email::email_sock怎麽用?PHP email::email_sock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在email的用法示例。


在下文中一共展示了email::email_sock方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: lostUsername

    public function lostUsername()
    {
        global $mysql, $langArray, $config, $meta;
        $mysql->query("\n\t\t\tSELECT *\n\t\t\tFROM `users`\n\t\t\tWHERE `email` = '" . sql_quote($_POST['email']) . "'\n\t\t", __FUNCTION__);
        if ($mysql->num_rows() == 0) {
            return 'error_invalid_user_email';
        }
        $d = $mysql->fetch_array();
        //判斷有無客服管理模塊
        require_once ROOT_PATH . '/apps/app_extends/models/app_extends.class.php';
        $app_extends = new app_extends();
        if ($app_extends->is_service()) {
            //通過用戶id獲取關聯客服
            require_once ROOT_PATH . '/apps/service/models/service.class.php';
            $service = new service();
            $theservice = $service->getserviceByuserid($d['user_id']);
            require_once ENGINE_PATH . 'classes/email.class.php';
            $emailClass = new email();
            $emailClass->fromEmail = 'no-reply@' . $config['domain'];
            $emailClass->contentType = 'text/html';
            $emailClass->subject = '[' . $meta['meta_title'] . ']發給[' . $d['username'] . ']的找回用戶名郵件';
            $emailClass->message = '[' . $d['username'] . ']!<br />
							    &nbsp;&nbsp;&nbsp;&nbsp;什麽?你連用戶名都能忘?你是不是打算把小編也忘了,太殘忍了! <br />
								&nbsp;&nbsp;&nbsp;&nbsp;算了,不跟你計較,這是你的用戶名:<br />
								&nbsp;&nbsp;&nbsp;&nbsp;帳號:[' . $d['username'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;不許再忘哦!<br />
                                <br />
								&nbsp;&nbsp;&nbsp;&nbsp;專屬小編:[' . $theservice['user_name'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . $meta['meta_title'] . ']<br />
								&nbsp;&nbsp;&nbsp;&nbsp;[' . date('Y-m-d H:i:s', time()) . ']<br />';
            require_once ROOT_PATH . '/apps/system/models/system.class.php';
            $system = new system();
            $smtp = $system->is_smtp();
            $smtpconf = $system->getAllKeyValue();
            if ($smtp) {
                $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
                $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $d['email'], $smtpconf["smtp_from_name"]);
                unset($emailClass);
                return true;
            }
            $emailClass->to($d['email']);
            $emailClass->send();
            unset($emailClass);
            return true;
        }
        require_once ENGINE_PATH . 'classes/email.class.php';
        $emailClass = new email();
        $emailClass->fromEmail = 'no-reply@' . $config['domain'];
        $emailClass->subject = '[' . $config['domain'] . '] ' . $langArray['email_lost_username'];
        $emailClass->message = langMessageReplace($langArray['email_lost_username_text'], array('DOMAIN' => $config['domain'], 'USERNAME' => $d['username']));
        require_once ROOT_PATH . '/apps/system/models/system.class.php';
        $system = new system();
        $smtp = $system->is_smtp();
        $smtpconf = $system->getAllKeyValue();
        if ($smtp) {
            $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
            $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $d['email'], $smtpconf["smtp_from_name"]);
            unset($emailClass);
            return true;
        }
        $emailClass->to($d['email']);
        $emailClass->send();
        unset($emailClass);
        return true;
    }
開發者ID:yunsite,項目名稱:demila,代碼行數:65,代碼來源:users.class.php

示例2: unapproveDeleteUpdate

 public function unapproveDeleteUpdate($id)
 {
     global $mysql, $item, $data, $langArray, $config, $meta;
     if (!isset($_POST['comment_to_user']) || trim($_POST['comment_to_user']) == '') {
         return $langArray['error_set_comment_to_user'];
     }
     $setQuery = '';
     //獲取當前作品曆史數據
     $mysql->query("\n\t\t\tSELECT *\n\t\t\tFROM `temp_items`\n\t\t\tWHERE `item_id` = '" . intval($item['id']) . "'\n\t\t\tLIMIT 1\n\t\t");
     $temp_item_data = $mysql->fetch_array();
     //回滾作品
     $mysql->query("\n\t\t\tUPDATE `items`\n\t\t\tSET \n\t\t\t`status` = 'active'\n\t\t\tWHERE `id` = '" . intval($item['id']) . "'\n\t\t\tLIMIT 1\n\t\t");
     //檢測預覽文件狀態
     if (!empty($temp_item_data['theme_preview'])) {
         //刪除新增預覽圖
         $this->del_preview($item['id'], true);
         //回滾原預覽文件
         $preview_arr = json_decode($temp_item_data['theme_preview'], 1);
         foreach ($preview_arr as $value) {
             $this->save_theme_preview($item['id'], $value, 1);
         }
     }
     $this->deleteUpdate($item['id']);
     ////判斷有無客服管理模塊
     //        require_once ROOT_PATH.'/apps/app_extends/models/app_extends.class.php';
     //
     //        $app_extends=new app_extends();
     //        if($app_extends->is_service()){
     //            //獲取用戶信息
     //            require_once ROOT_PATH.'/apps/users/models/users.class.php';
     //            $user = new users();
     //            $user_info = $user->getuserinfoById($item['user_id']);
     //            //通過用戶id獲取關聯客服
     //            require_once ROOT_PATH.'/apps/service/models/service.class.php';
     //            $service = new service();
     //            $theservice = $service->getserviceByuserid($item['user_id']);
     //            $item_url = $config['domain'].'/'.$languageURL.'items/'.$item['id'];
     //            #給用戶發郵件
     //            require_once ENGINE_PATH.'/classes/email.class.php';
     //            $emailClass = new email();
     //
     //            $emailClass->fromEmail = 'no-reply@'.$config['domain'];
     //            $emailClass->contentType = 'text/html';
     //            $emailClass->subject = '你的作品['.$item['name'].']更新被拒絕';
     //            $emailClass->message = 'Hi!['.$user_info['username'].']:<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;很抱歉你的作品['.$item['name'].']更新因以下原因被拒絕:<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;['.$_POST['comment_to_user'].']<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;不要失望好麽?小編其實也很難過!<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;一定要再接再厲,小編為你加油!<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;Fighting!<br />
     //                                <br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;專屬小編:['.$theservice['user_name'].']<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;['.$meta['meta_title'].']<br />
     //								&nbsp;&nbsp;&nbsp;&nbsp;['.date('Y-m-d H:i:s',time()).']<br />';
     //            require_once ROOT_PATH.'/apps/system/models/system.class.php';
     //            $system = new system();
     //            $smtp = $system ->is_smtp();
     //            $smtpconf=$system->getAllKeyValue();
     //            if($smtp){
     //                $emailClass->email_sock($smtpconf["smtp_host"],$smtpconf["smtp_port"],0,'error',10,1,$smtpconf["smtp_user"],$smtpconf["smtp_pass"],$smtpconf["smtp_from"]);
     //                $emailClass->send_mail_sock($emailClass->subject,$emailClass->message,$user_info['email'],$smtpconf["smtp_from_name"]) ;
     //                unset($emailClass);
     //            }else{
     //                $emailClass->to($user_info['email']);
     //                $emailClass->send();
     //                unset($emailClass);
     //            }
     //        }else{
     #給用戶發郵件
     require_once ENGINE_PATH . '/classes/email.class.php';
     $emailClass = new email();
     $emailClass->fromEmail = 'no-reply@' . $config['domain'];
     $emailClass->subject = '[' . $config['domain'] . '] ' . $langArray['email_unapprove_delete_item_update_subject'];
     $emailClass->message = langMessageReplace($langArray['email_unapprove_delete_item_update_text'], array('THEMENAME' => $item['name'], 'COMMENT' => $_POST['comment_to_user']));
     require_once ROOT_PATH . '/apps/system/models/system.class.php';
     $system = new system();
     $smtp = $system->is_smtp();
     $smtpconf = $system->getAllKeyValue();
     if ($smtp) {
         $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
         $emailClass->send_mail_sock($emailClass->subject, $emailClass->message, $user_info['email'], $smtpconf["smtp_from_name"]);
         unset($emailClass);
     } else {
         $emailClass->to($item['user']['email']);
         $emailClass->send();
         unset($emailClass);
     }
     //        }
     return true;
 }
開發者ID:yunsite,項目名稱:demila,代碼行數:90,代碼來源:items.class.php

示例3: die

    $sys->unuse_smtp();
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
if (isset($_POST['edit']) && isset($_POST['value']) && $_POST['value'] == 'smtp') {
    require_once ROOT_PATH . "/apps/system/models/system.class.php";
    $sys = new system();
    $sys->use_smtp();
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
if (isset($_POST['email'])) {
    require_once ROOT_PATH . "/apps/system/models/system.class.php";
    $system = new system();
    $smtpconf = $system->getAllKeyValue();
    require_once ENGINE_PATH . '/classes/email.class.php';
    $emailClass = new email();
    $emailClass->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
    if ($emailClass->send_mail_sock("測試郵件", "這是一封測試郵件", $_POST['email'], $smtpconf["smtp_from_name"]) == 1) {
        die(json_encode(array('status' => '發送成功')));
    } else {
        die(json_encode(array('status' => '發送失敗,請正確配置SMTP')));
    }
}
if (isset($_POST['edit']) && isset($_POST['value']) && $_POST['value'] == 'template') {
    require_once ROOT_PATH . "/apps/system/models/system.class.php";
    $sys = new system();
    $sys->edit_template($_POST["template"]);
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
if (isset($_POST['edit']) && isset($_POST['value']) && $_POST['value'] == 'admin_template') {
    require_once ROOT_PATH . "/apps/system/models/system.class.php";
    $sys = new system();
開發者ID:yunsite,項目名稱:demila,代碼行數:31,代碼來源:edit.php

示例4: add

 public function add()
 {
     global $mysql, $langArray, $config;
     if (!isset($_POST['name']) || trim($_POST['name']) == '') {
         $error['name'] = $langArray['error_fill_this_field'];
     }
     if (!isset($_POST['text']) || trim($_POST['text']) == '') {
         $error['text'] = $langArray['error_fill_this_field'];
     }
     if (!isset($_POST['send_to']) || trim($_POST['send_to']) == '') {
         $error['send_to'] = $langArray['error_fill_this_field'];
     }
     if (isset($_POST['send_to']) && $_POST['send_to'] == 'city' && (!isset($_POST['city_id']) || !is_numeric($_POST['city_id']))) {
         $error['city'] = $langArray['error_fill_this_field'];
     }
     if (isset($_POST['send_to']) && $_POST['send_to'] == 'group' && (!isset($_POST['bgroup_id']) || !is_numeric($_POST['bgroup_id']))) {
         $error['group'] = $langArray['error_fill_this_field'];
     }
     if (isset($error)) {
         return $error;
     }
     $sendID = 0;
     if ($_POST['send_to'] == 'city') {
         $sendID = $_POST['city_id'];
     } elseif ($_POST['send_to'] == 'group') {
         $sendID = $_POST['bgroup_id'];
     }
     $mysql->query("\n\t\t\tINSERT INTO `bulletin` (\n\t\t\t\t`name`,\n\t\t\t\t`text`,\n\t\t\t\t`datetime`,\n\t\t\t\t`send_to`,\n\t\t\t\t`send_id`\n\t\t\t)\n\t\t\tVALUES (\n\t\t\t\t'" . sql_quote($_POST['name']) . "',\n\t\t\t\t'" . sql_quote($_POST['text']) . "',\n\t\t\t\tNOW(),\n\t\t\t\t'" . sql_quote($_POST['send_to']) . "',\n\t\t\t\t'" . intval($sendID) . "'\n\t\t\t)\n\t\t", __FUNCTION__);
     $bulletinID = $mysql->insert_id();
     #加載訂閱列表
     if ($_POST['send_to'] == 'city') {
         $mysql->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `users`\n\t\t\t\tWHERE `city_id` = '" . intval($_POST['city_id']) . "' AND `bulletin_subscribe` = 'true'\n\t\t\t");
         if ($mysql->num_rows() > 0) {
             while ($d = $mysql->fetch_array()) {
                 $emails[] = $d['email'];
             }
         }
     }
     #加載分組
     if ($_POST['send_to'] == 'group') {
         $mysql->query("\n\t\t\t\tSELECT u.*\n\t\t\t\tFROM `bulletin_users` AS bg\t\t\t\t\n\t\t\t\tJOIN `users` AS u\n\t\t\t\tON u.`user_id` = bg.`user_id` AND u.`bulletin_subscribe` = 'true'\n\t\t\t\tWHERE bg.`bulletingroup_id` = '" . intval($_POST['bgroup_id']) . "'\n\t\t\t");
         if ($mysql->num_rows() > 0) {
             while ($d = $mysql->fetch_array()) {
                 $emails[] = $d['email'];
             }
         }
     }
     #加載全部
     if ($_POST['send_to'] == 'active') {
         $mysql->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `users`\n\t\t\t\tWHERE `bulletin_subscribe` = 'true'\n\t\t\t");
         if ($mysql->num_rows() > 0) {
             while ($d = $mysql->fetch_array()) {
                 $emails[] = $d['email'];
             }
         }
     }
     #加載全部
     if ($_POST['send_to'] == 'admins') {
         $mysql->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `admins`\n\t\t\t\tWHERE `bulletin_subscribe` = 'true'\n\t\t\t");
         if ($mysql->num_rows() > 0) {
             while ($d = $mysql->fetch_array()) {
                 $emails[] = $d['email'];
             }
         }
     }
     #加載全部
     if ($_POST['send_to'] == 'site') {
         $mysql->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `bulletin_emails`\n\t\t\t\tWHERE `bulletin_subscribe` = 'true'\n\t\t\t");
         if ($mysql->num_rows() > 0) {
             while ($d = $mysql->fetch_array()) {
                 $emails[] = $d['email'];
             }
         }
     }
     #獲取模板
     $mysql->query("\n\t\t\tSELECT *\n\t\t\tFROM `bulletin_template`\n\t\t\tORDER BY `id` DESC\n\t\t\tLIMIT 1\n\t\t");
     if ($mysql->num_rows() > 0) {
         $template = $mysql->fetch_array();
         $template = $template['template'];
     } else {
         $template = '{$CONTENT}';
     }
     if (isset($emails)) {
         require_once $config['system_core'] . 'classes/email.class.php';
         foreach ($emails as $email) {
             $mail = new email();
             $mail->fromEmail = 'no-reply@' . $config['domain'];
             $mail->to($email);
             $mail->subject = '[' . $config['domain'] . '] ' . $_POST['name'];
             $mail->contentType = 'text/html';
             $mail->message = langMessageReplace($template, array('DOMAIN' => $config['domain'], 'BULLETINID' => $bulletinID, 'EMAIL' => $email, 'CONTENT' => $_POST['text']));
             require_once ROOT_PATH . '/apps/system/models/system.class.php';
             $system = new system();
             $smtp = $system->is_smtp();
             $smtpconf = $system->getAllKeyValue();
             if ($smtp) {
                 $mail->email_sock($smtpconf["smtp_host"], $smtpconf["smtp_port"], 0, 'error', 10, 1, $smtpconf["smtp_user"], $smtpconf["smtp_pass"], $smtpconf["smtp_from"]);
                 $mail->send_mail_sock($mail->subject, $mail->message, $email, $smtpconf["smtp_from_name"]);
                 unset($emailClass);
             } else {
//.........這裏部分代碼省略.........
開發者ID:yunsite,項目名稱:demila,代碼行數:101,代碼來源:bulletin.class.php


注:本文中的email::email_sock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。