本文整理匯總了PHP中mailer::get_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP mailer::get_instance方法的具體用法?PHP mailer::get_instance怎麽用?PHP mailer::get_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mailer
的用法示例。
在下文中一共展示了mailer::get_instance方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: send
/**
* 發送郵件
*/
public function send($limit = 5)
{
$this->clear();
//根據優先級排序獲取
$mails = $this->where(array('lock_expiry' => array('lt', time())))->order('priority DESC,id,err_num')->limit($limit)->select();
if (!$mails) {
return false;
}
//增加一次發送錯誤並且把鎖定時間延長避免多個發送請求衝突
$qids = array();
foreach ($mails as $_mail) {
$qids[] = $_mail['id'];
}
$this->where(array('id' => array('in', $qids)))->save(array('err_num' => array('exp', 'err_num+1'), 'lock_expiry' => array('exp', 'lock_expiry+' . $this->_send_lock)));
//發送
$mailer = mailer::get_instance();
foreach ($mails as $_mail) {
if ($mailer->send($_mail['mail_to'], $_mail['mail_subject'], $_mail['mail_body'])) {
//刪除隊列
$this->delete($_mail['id']);
} else {
//失敗暫不處理
}
}
}
示例2: ajax_mail_test
public function ajax_mail_test() {
$email = $this->_get('email', 'trim');
!$email && $this->ajaxReturn(0);
//發送
$mailer = mailer::get_instance();
if ($mailer->send($email, L('send_test_email_subject'), L('send_test_email_body'))) {
$this->ajaxReturn(1);
} else {
$this->ajaxReturn(0);
}
}
示例3: ajax_mail_test
public function ajax_mail_test()
{
$email = $this->_get('email', 'trim');
!$email && $this->ajaxReturn(0);
//發送
$mailer = mailer::get_instance();
if ($mailer->send($email, '這是一封測試郵件', '這是一封飛天俠秒殺程序自動發送的測試郵件')) {
$this->ajaxReturn(1);
} else {
$this->ajaxReturn(0);
}
}
示例4: pay
//.........這裏部分代碼省略.........
}
} else {
$userId = $this->visitor->info['id'];
$address = $user_address->where("uid='{$userId}'")->find($address_options);
//取到地址
$data['address_name'] = $address['consignee'];
//收貨人姓名
$data['mobile'] = $address['mobile'];
//電話號碼
$data['address'] = $address['sheng'] . $address['shi'] . $address['qu'] . $address['address'];
//地址
}
if ($orderid = $item_order->data($data)->add()) {
$orders['orderId'] = $dingdanhao;
foreach ($_SESSION['cart'] as $item) {
$item_goods->where('id=' . $item['id'])->setDec('goods_stock', $item['num']);
$orders['itemId'] = $item['id'];
//商品ID
$orders['title'] = $item['name'];
//商品名稱
$orders['img'] = $item['img'];
//商品圖片
$orders['price'] = $item['price'];
//商品價格
$orders['quantity'] = $item['num'];
//購買數量
$orders['color'] = $item['color'];
//購買數量
$order_detail->data($orders)->add();
}
$cart->clear();
//清空購物車
$payment_id = $_POST['payment_id'];
$item_order = M('item_order')->where(" orderId='{$dingdanhao}'")->find();
!$item_order && $this->_404();
$title = '新訂單' . $data['goods_sumPrice'] . '元';
$content = '您收到訂單' . $dingdanhao . ',商品' . $orders['quantity'] . '件,總價格' . $data['goods_sumPrice'] . '元。購買者姓名:' . $consignee . '。收貨人地址:' . $data['address'];
$tips_data = M('setting')->where(" name='tips'")->find();
$emails = unserialize($tips_data['data']);
if ($payment_id == 2) {
$data['status'] = 2;
$data['supportmetho'] = 2;
$data['support_time'] = time();
if (M('item_order')->where("orderId='{$dingdanhao}'")->data($data)->save()) {
$_SESSION['end'] = 1;
if ($emails && !empty($emails)) {
$mailer = mailer::get_instance();
$mailer->send($emails, $title, $content);
}
$this->redirect('Shopcart/index');
} else {
$this->error('操作失敗!');
}
} elseif ($payment_id == 1) {
$data['supportmetho'] = 1;
$userId = $this->visitor->info['id'];
if (M('item_order')->where("and orderId='{$dingdanhao}'")->data($data)->save()) {
$alipay = M('alipay')->find();
echo "<script>location.href='api/wapalipay/alipayapi.php?WIDseller_email=" . $alipay['alipayname'] . "&WIDout_trade_no=" . $dingdanhao . "&WIDsubject=" . $dingdanhao . "&WIDtotal_fee=" . $item_order['order_sumPrice'] . "'</script>";
} else {
$this->error('操作失敗!');
}
} else {
$this->error('操作失敗!');
}
$this->assign('orderid', $orderid);
//訂單ID
$this->assign('dingdanhao', $dingdanhao);
//訂單號
$this->assign('order_sumPrice', $data['order_sumPrice']);
} else {
$this->error('生成訂單失敗!');
}
} else {
if (isset($_GET['orderId'])) {
$item_order = M('item_order');
$orderId = $_GET['orderId'];
//訂單號
$userId = $this->visitor->info['id'];
$orders = $item_order->where("userId='{$userId}' and orderId='{$orderId}'")->find();
if (!is_array($orders)) {
$this->_404();
}
if (empty($orders['supportmetho'])) {
$this->assign('orderid', $orders['id']);
//訂單ID
$this->assign('dingdanhao', $orders['orderId']);
//訂單號
$this->assign('order_sumPrice', $orders['order_sumPrice']);
} else {
$alipay = M('alipay')->find();
echo "<script>location.href='api/wapalipay/alipayapi.php?WIDseller_email=" . $alipay['alipayname'] . "&WIDout_trade_no=" . $orderId . "&WIDsubject=" . $orderId . "&WIDtotal_fee=" . $orders['order_sumPrice'] . "'</script>";
exit;
}
} else {
$this->redirect('Index/index?m=Item&a=index&id=127');
}
}
$this->display();
}