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


PHP gcms::customMail方法代碼示例

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


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

示例1: elseif

        if (gcms::isAdmin()) {
            $sender = $db->getRec(DB_USER, $_POST['email_from']);
        } else {
            $sender = $_SESSION['login'];
        }
        // ตรวจสอบค่าที่ส่งมา
        if ($sender['email'] == '') {
            $ret['error'] = 'ACTION_ERROR';
        } elseif ($reciever == '') {
            $ret['error'] = 'RECIEVER_EMPTY';
            $ret['input'] = 'email_reciever';
        } elseif ($sender == $reciever) {
            $ret['error'] = 'ACTION_ERROR';
        } elseif ($topic == '') {
            $ret['error'] = 'TOPIC_EMPTY';
            $ret['input'] = 'email_subject';
        } elseif ($detail == '') {
            $ret['error'] = 'DETAIL_EMPTY';
        } else {
            $error = gcms::customMail($reciever, "{$sender['email']}<{$sender['displayname']}>", $topic, $detail);
            if ($error == '') {
                $ret['error'] = 'EMAIL_SEND_SUCCESS';
                $ret['location'] = 'back';
            } else {
                $ret['alert'] = rawurlencode($error);
            }
        }
    }
    // คืนค่าเป็น JSON
    echo gcms::array2json($ret);
}
開發者ID:goragod,項目名稱:php-framework-benchmark,代碼行數:31,代碼來源:mailto.php

示例2: sendMail

 /**
  * ฟังก์ชั่นส่งเมล์จากแม่แบบจดหมาย
  *
  * @global resource $db database resource
  * @global array $config ตัวแปรเก็บการตั้งค่าของ GCMS
  * @global int $mmktime เวลาปัจจุบัน (mktime)
  * @param int $id ID ของจดหมายที่ต้องการส่ง
  * @param string $module ชื่อโมดูลของจดหมายที่ต้องการส่ง
  * @param array $datas ข้อมูลที่จะถูกแทนที่ลงในจดหมาย ในรูป 'ตัวแปร'=>'ข้อความ'
  * @param string $to ที่อยู่อีเมล์ผู้รับ  คั่นแต่ละรายชื่อด้วย ,
  * @return string สำเร็จคืนค่าว่าง ไม่สำเร็จ คืนค่าข้อความผิดพลาด
  */
 public static function sendMail($id, $module, $datas, $to)
 {
     global $db, $config, $mmktime;
     $sql = "SELECT * FROM `" . DB_EMAIL_TEMPLATE . "`";
     $sql .= " WHERE `module`='{$module}' AND `email_id`='{$id}' AND `language` IN ('" . LANGUAGE . "','th')";
     $sql .= " LIMIT 1";
     $email = $db->customQuery($sql);
     if (sizeof($email) == 0) {
         return 'Error : email template not found.';
     } else {
         $email = $email[0];
         // ข้อความในอีเมล์
         $replace = array();
         $replace['/%WEBTITLE%/'] = strip_tags($config['web_title']);
         $replace['/%WEBURL%/'] = WEB_URL;
         $replace['/%EMAIL%/'] = $to;
         $replace['/%ADMINEMAIL%/'] = empty($email['from_email']) ? $config['noreply_email'] : $email['from_email'];
         $replace['/%TIME%/'] = gcms::mktime2date($mmktime);
         $replace = array_merge($replace, $datas);
         $patt = array_keys($replace);
         $replace = array_values($replace);
         $msg = preg_replace($patt, $replace, $email['detail']);
         $subject = preg_replace($patt, $replace, $email['subject']);
         // ส่งอีเมล์
         return gcms::customMail($to . (!empty($email['copy_to']) ? ",{$email['copy_to']}" : ''), $email['from_email'], $subject, $msg);
     }
 }
開發者ID:phannack,項目名稱:GCMS,代碼行數:39,代碼來源:class.gcms.php

示例3: elseif

            $ret['error'] = 'ACTION_ERROR';
            $ret['input'] = 'mail_reciever';
        } elseif ($sender == $reciever) {
            $ret['error'] = 'EMAIL_SEND_SELF';
            $ret['input'] = 'mail_sender';
        } elseif ($topic == '') {
            $ret['error'] = 'TOPIC_EMPTY';
            $ret['input'] = 'mail_topic';
        } elseif ($detail == '') {
            $ret['error'] = 'DETAIL_EMPTY';
        } elseif ($_POST['mail_antispam'] != $_SESSION[$_POST['antispam']]) {
            $ret['ret_mail_antispam'] = 'this';
            $ret['input'] = 'mail_antispam';
        } else {
            // ส่งอีเมล์
            $error = gcms::customMail($reciever, $sender, $topic, $detail);
            // clear antispam
            unset($_SESSION['emails']);
            unset($_SESSION[$_POST['antispam']]);
            // คืนค่า
            if ($error == '') {
                $ret['error'] = 'EMAIL_SEND_SUCCESS';
                $ret['location'] = 'back';
            } else {
                $ret['alert'] = rawurlencode($error);
            }
        }
    }
    // คืนค่าเป็น JSON
    echo gcms::array2json($ret);
}
開發者ID:phannack,項目名稱:GCMS,代碼行數:31,代碼來源:sendmail.php

示例4: elseif

         } elseif (!gcms::validMail($sender['email'])) {
             $ret['error'] = 'REGISTER_INVALID_EMAIL';
             $ret['input'] = 'mail_sender';
         } elseif (sizeof($emails) == 0) {
             $ret['error'] = 'EMAIL_RECIEVER_NOT_FOUND';
         } elseif ($topic == '') {
             $ret['error'] = 'TOPIC_EMPTY';
             $ret['input'] = 'mail_topic';
         } elseif ($detail == '') {
             $ret['error'] = 'DETAIL_EMPTY';
         } elseif ($_POST['mail_antispam'] != $_SESSION[$_POST['antispam']]) {
             $ret['ret_mail_antispam'] = 'this';
             $ret['input'] = 'mail_antispam';
         } else {
             // ส่งอีเมล์
             $error = gcms::customMail(implode(',', $emails), "{$sender['email']}<{$sender['displayname']}>", $topic, $detail);
             // clear antispam
             unset($_SESSION['emails']);
             unset($_SESSION[$_POST['antispam']]);
             // คืนค่า
             if ($error == '') {
                 $ret['error'] = 'EMAIL_SEND_SUCCESS';
                 $ret['location'] = 'back';
             } else {
                 $ret['alert'] = rawurlencode($error);
             }
         }
     }
 }
 // คืนค่าเป็น JSON
 echo gcms::array2json($ret);
開發者ID:phannack,項目名稱:GCMS,代碼行數:31,代碼來源:mailto.php


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