当前位置: 首页>>代码示例>>PHP>>正文


PHP Mailer::sendmail方法代码示例

本文整理汇总了PHP中Mailer::sendmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::sendmail方法的具体用法?PHP Mailer::sendmail怎么用?PHP Mailer::sendmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailer的用法示例。


在下文中一共展示了Mailer::sendmail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onError

 function onError($error)
 {
     global $ost, $thisstaff;
     $ost->logError('Upgrader Error', $error);
     $this->setError($error);
     $this->setState('aborted');
     //Alert staff upgrading the system - if the email is not same as admin's
     // admin gets alerted on error log (above)
     if (!$thisstaff || !strcasecmp($thisstaff->getEmail(), $ost->getConfig()->getAdminEmail())) {
         return;
     }
     $email = null;
     if (!($email = $ost->getConfig()->getAlertEmail())) {
         $email = $ost->getConfig()->getDefaultEmail();
     }
     //will take the default email.
     $subject = 'Upgrader Error';
     if ($email) {
         $email->send($thistaff->getEmail(), $subject, $error);
     } else {
         //no luck - try the system mail.
         Mailer::sendmail($thistaff->getEmail(), $subject, $error, sprintf('"osTicket Alerts"<%s>', $thistaff->getEmail()));
     }
 }
开发者ID:nunomartins,项目名称:osTicket-1.7,代码行数:24,代码来源:class.upgrader.php

示例2: define

//Not in use anymore....as of v 1.7
define('SLA_TABLE', TABLE_PREFIX . 'sla');
define('API_KEY_TABLE', TABLE_PREFIX . 'api_key');
define('TIMEZONE_TABLE', TABLE_PREFIX . 'timezone');
#Connect to the DB && get configuration from database
$ferror = null;
if (!db_connect(DBHOST, DBUSER, DBPASS) || !db_select_database(DBNAME)) {
    $ferror = 'Unable to connect to the database';
} elseif (!($ost = osTicket::start(1)) || !($cfg = $ost->getConfig())) {
    $ferror = 'Unable to load config info from DB. Get tech support.';
}
if ($ferror) {
    //Fatal error
    //try alerting admin using email in config file
    $msg = $ferror . "\n\n" . THISPAGE;
    Mailer::sendmail(ADMIN_EMAIL, 'osTicket Fatal Error', $msg, sprintf('"osTicket Alerts"<%s>', ADMIN_EMAIL));
    //Display generic error to the user
    die("<b>Fatal Error:</b> Contact system administrator.");
    exit;
}
//Init
$session = $ost->getSession();
//System defaults we might want to make global//
#pagenation default - user can overwrite it!
define('DEFAULT_PAGE_LIMIT', $cfg->getPageSize() ? $cfg->getPageSize() : 25);
#Cleanup magic quotes crap.
if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
    $_POST = Format::strip_slashes($_POST);
    $_GET = Format::strip_slashes($_GET);
    $_REQUEST = Format::strip_slashes($_REQUEST);
}
开发者ID:nunomartins,项目名称:osTicket-1.7,代码行数:31,代码来源:main.inc.php

示例3: croak

 function croak($message)
 {
     $msg = $message . "\n\n" . THISPAGE;
     Mailer::sendmail(ADMIN_EMAIL, 'osTicket Fatal Error', $msg, sprintf('"osTicket Alerts"<%s>', ADMIN_EMAIL));
     //Display generic error to the user
     Http::response(500, "<b>Fatal Error:</b> Contact system administrator.");
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:7,代码来源:bootstrap.php

示例4: alertAdmin

 function alertAdmin($subject, $message, $log = false)
 {
     //Set admin's email address
     if (!($to = $this->getConfig()->getAdminEmail())) {
         $to = ADMIN_EMAIL;
     }
     //append URL to the message
     $message .= "\n\n" . $this->getConfig()->getBaseUrl();
     //Try getting the alert email.
     $email = null;
     if (!($email = $this->getConfig()->getAlertEmail())) {
         $email = $this->getConfig()->getDefaultEmail();
     }
     //will take the default email.
     if ($email) {
         $email->sendAlert($to, $subject, $message, null, array('text' => true));
     } else {
         //no luck - try the system mail.
         Mailer::sendmail($to, $subject, $message, sprintf('"osTicket Alerts"<%s>', $to));
     }
     //log the alert? Watch out for loops here.
     if ($log) {
         $this->log(LOG_CRIT, $subject, $message, false);
     }
     //Log the entry...and make sure no alerts are resent.
 }
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:26,代码来源:class.osticket.php

示例5: onError

 function onError($error)
 {
     global $ost, $thisstaff;
     $subject = '[' . $this->name . ']: ' . _S('Upgrader Error');
     $ost->logError($subject, $error);
     $this->setError($error);
     $this->upgrader->setState('aborted');
     //Alert staff upgrading the system - if the email is not same as admin's
     // admin gets alerted on error log (above)
     if (!$thisstaff || !strcasecmp($thisstaff->getEmail(), $ost->getConfig()->getAdminEmail())) {
         return;
     }
     $email = null;
     if (!($email = $ost->getConfig()->getAlertEmail())) {
         $email = $ost->getConfig()->getDefaultEmail();
     }
     //will take the default email.
     if ($email) {
         $email->sendAlert($thisstaff->getEmail(), $subject, $error);
     } else {
         //no luck - try the system mail.
         Mailer::sendmail($thisstaff->getEmail(), $subject, $error, '"' . _S('osTicket Alerts') . "\" <{$thisstaff->getEmail()}>");
     }
 }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:24,代码来源:class.upgrader.php

示例6: checkout_post

 public function checkout_post()
 {
     $data = $this->data;
     $this->form_validation->set_rules('receive_name_Str', '收件人姓名', 'required');
     $this->form_validation->set_rules('receive_address_Str', '收件人地址', 'required');
     $this->form_validation->set_rules('receive_phone_Str', '收件人電話', 'required');
     if ($this->form_validation->run() !== FALSE) {
         $receive_name_Str = $this->input->post('receive_name_Str', TRUE);
         $receive_address_Str = $this->input->post('receive_address_Str', TRUE);
         $receive_phone_Str = $this->input->post('receive_phone_Str', TRUE);
         $receive_time_Str = $this->input->post('receive_time_Str', TRUE);
         $receive_remark_Str = $this->input->post('receive_remark_Str', TRUE);
         //讀取建構中的訂單
         $OrderShop = new OrderShop(['db_where_Arr' => array('uid_Num' => $data['User']->uid_Num, 'order_status_Num' => -1)]);
         if ($OrderShop->pay_paytype_Str === 'card') {
             $OrderShop->pay_status_Num = 1;
             $OrderShop->paycheck_status_Num = 1;
         } else {
             if ($OrderShop->pay_paytype_Str === 'cash_on_delivery') {
                 $OrderShop->pay_status_Num = 1;
             }
         }
         $OrderShop->receive_name_Str = $receive_name_Str;
         $OrderShop->receive_address_Str = $receive_address_Str;
         $OrderShop->receive_phone_Str = $receive_phone_Str;
         $OrderShop->receive_time_Str = $receive_time_Str;
         $OrderShop->receive_remark_Str = $receive_remark_Str;
         //將訂單從建構中改為已建立
         $finish_order_Return = $OrderShop->finish_order();
         if ($finish_order_Return === TRUE) {
             //寄出訂單新增通知給管理員
             $smtp_email_Setting = new Setting(['db_where_Arr' => ['keyword_Str' => 'smtp_email']]);
             $smtp_username_Setting = new Setting(['db_where_Arr' => ['keyword_Str' => 'smtp_username']]);
             $email_Str = $smtp_email_Setting->value_Str;
             $email_name_Str = $smtp_username_Setting->value_Str;
             $title_Str = '訂單成交通知';
             $message_Str = '您好:<br><br>我們已經收到一則訂單資訊!<br><br>' . '購買人:' . $data['User']->email_Str . '<br>' . '購買的產品如下:<br><br>';
             foreach ($OrderShop->cart_CartShopList->obj_Arr as $key => $value_CartShop) {
                 $message_Str .= $value_CartShop->product_ProductShop->name_Str . ' ( ' . $value_CartShop->StockProductShop->classname1_Str . ' / ' . $value_CartShop->StockProductShop->classname2_Str . ' ) ' . '單價' . $value_CartShop->price_Num . '元 * ' . $value_CartShop->amount_Num . ' 總價共 ' . $value_CartShop->price_total_Num . '元<br>';
             }
             $message_Str .= '<br><br>運費總金額:' . $OrderShop->pay_price_freight_Num . '元<br>' . '購物總金額(含運費):' . $OrderShop->pay_price_total_Num . '元<br><br>' . '訂購時間:' . date('Y-m-d H:i:s');
             $Mailer = new Mailer();
             $return_message_Str = $Mailer->sendmail($email_Str, $email_name_Str, $title_Str, $message_Str);
             if ($return_message_Str === TRUE) {
                 //寄件成功
             } else {
                 //送出訊息
                 $this->load->model('Message');
                 $this->Message->show(array('message' => 'error(4):郵件伺服器出錯', 'url' => 'order/cartlist'));
                 return FALSE;
             }
             //寄出下單通知給買家
             $email_Str = $data['User']->email_Str;
             $email_name_Str = $data['User']->email_Str;
             $title_Str = '訂單成交通知';
             $message_Str = '您好:<br><br>我們收到您的訂單資訊!<br><br>' . '購買人:' . $data['User']->email_Str . '<br>' . '購買的產品如下:<br><br>';
             foreach ($OrderShop->cart_CartShopList->obj_Arr as $key => $value_CartShop) {
                 $message_Str .= $value_CartShop->product_ProductShop->name_Str . ' ( ' . $value_CartShop->StockProductShop->classname1_Str . ' / ' . $value_CartShop->StockProductShop->classname2_Str . ' ) ' . '單價' . $value_CartShop->price_Num . '元 * ' . $value_CartShop->amount_Num . ' 總價共 ' . $value_CartShop->price_total_Num . '元<br>';
             }
             $message_Str .= '<br><br>運費總金額:' . $OrderShop->pay_price_freight_Num . '元<br>' . '購物總金額(含運費):' . $OrderShop->pay_price_total_Num . '元<br><br>' . '訂購時間:' . date('Y-m-d H:i:s');
             $Mailer = new Mailer();
             $return_message_Str = $Mailer->sendmail($email_Str, $email_name_Str, $title_Str, $message_Str);
             if ($return_message_Str === TRUE) {
                 //寄件成功
             } else {
                 //送出訊息
                 $this->load->model('Message');
                 $this->Message->show(array('message' => 'error(4):郵件伺服器出錯', 'url' => 'order/cartlist'));
                 return FALSE;
             }
             $message_Str = '訂單完成';
             $url_Str = 'admin/user/order_shop/order_shop/tablelist';
             $this->load->model('Message');
             $this->Message->show(array('message' => $message_Str, 'url' => $url_Str));
             return TRUE;
         } else {
             $message_Str = $finish_order_Return;
             $url_Str = 'order/cartlist';
             $this->load->model('Message');
             $this->Message->show(array('message' => $message_Str, 'url' => $url_Str, 'second' => 7));
             return TRUE;
         }
     } else {
         $message_Str = '請填寫詳細收件人資料';
         $url_Str = 'order/checkout';
         $this->load->model('Message');
         $this->Message->show(array('message' => $message_Str, 'url' => $url_Str));
     }
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:89,代码来源:Order.php


注:本文中的Mailer::sendmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。