本文整理汇总了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();
}