本文整理汇总了PHP中email::send_mail_sock方法的典型用法代码示例。如果您正苦于以下问题:PHP email::send_mail_sock方法的具体用法?PHP email::send_mail_sock怎么用?PHP email::send_mail_sock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email
的用法示例。
在下文中一共展示了email::send_mail_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 />
什么?你连用户名都能忘?你是不是打算把小编也忘了,太残忍了! <br />
算了,不跟你计较,这是你的用户名:<br />
帐号:[' . $d['username'] . ']<br />
不许再忘哦!<br />
<br />
专属小编:[' . $theservice['user_name'] . ']<br />
[' . $meta['meta_title'] . ']<br />
[' . 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;
}
示例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 />
// 很抱歉你的作品['.$item['name'].']更新因以下原因被拒绝:<br />
// ['.$_POST['comment_to_user'].']<br />
// 不要失望好么?小编其实也很难过!<br />
// 一定要再接再厉,小编为你加油!<br />
// Fighting!<br />
// <br />
// 专属小编:['.$theservice['user_name'].']<br />
// ['.$meta['meta_title'].']<br />
// ['.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;
}
示例3: die
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();
$sys->edit_admin_template($_POST["admin_template"]);
示例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 {
//.........这里部分代码省略.........