public function sendMail() { $mailbox = $_POST['mailbox']; $title = $_POST['title']; $content = $_POST['content']; $mail = new SaeMail(); //$mail->setAttach( array("my_photo.jpg" => "照片的二进制数据" )); $ret = $mail->quickSend($mailbox, $title, $content, "*****@*****.**", "jjaazz901222"); $mail->clean(); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { // 更新日志 //================= $data['module'] = '后台管理-邮件'; $data['operation'] = '发送邮件:mailbox=' . $mailbox . " title=" . $title; $data['update_user'] = $_SESSION['tennis-user']['id']; $data['ip'] = $this->getIP(); $log = M('operation_log'); $log->add($data); //================= $this->success('发送成功!', '/'); } }
$d=date('Y-m-d H:i:s'); $mail = new SaeMail(); $smtp_user='******'; $smtp_pass='******'; $ret = $kv->pkrget('web_', 3); foreach($ret as $arr => $url){ $url='http://'.$url; $tags = @get_meta_tags( $url ); if($tags['saecheckweb'] == 'www.lijingquan.net'){ $ret=$ekv->get('fail_'.$url); if ($ret == '1'){ echo $ret; }else{ $mto=$kv->get('mail_'.$url); $mail->quickSend($mto,'网站恢复正常!','你的网站'.$url.'已经进入正常状态,并处于监控模式!更多功能,正在开发!欢迎访问我的博客:www.lijingquan.net',$smtp_user,$smtp_pass); $mail->clean(); $ekv->set('fail_'.$url, '1'); } }else{ $ret=$ekv->get('fail_'.$url); if ($ret == '0'){ echo $ret; }else{ $mto=$kv->get('mail_'.$url); $mail->quickSend($mto,'网站发现异常!','你的网站'.$url.'已经进入正常状态,并处于监控模式!更多功能,正在开发!欢迎访问我的博客:www.lijingquan.net',$smtp_user,$smtp_pass); $mail->clean(); $ekv->set('fail_'.$url, '0'); } } echo '<br />'; }
public function reply() { $user = $_SESSION['tennis-user']; if ($user != null) { if ($user['is_forbidden'] == 1) { $this->error('很抱歉,言多必失,您已被封印! 解封日期请查看用户中心,如有必要请联系管理员!'); } } else { $this->error('很遗憾,您还未登录哟?!'); } $User = M("User"); $userList = $User->where('id=' . $_POST['user_id'])->getField('id, username, mailbox'); $data['invitation_id'] = $_POST['id']; $data['type'] = $_POST['type']; $data['user_id'] = $_SESSION['tennis-user']['id']; $data['comment'] = "回复" . $userList[$_POST['user_id']]['username'] . ":" . $_POST['comment']; $invitation_comment = M('invitation_comment'); $result = $invitation_comment->add($data); if ($result) { // 更新日志 //================= $data['module'] = '约球'; $data['operation'] = '回复球友:id=' . $_POST['id'] . "user_id:" . $_POST['user_id']; $data['update_user'] = $_SESSION['tennis-user']['id']; $data['ip'] = $this->getIP(); $log = M('operation_log'); $log->add($data); //================= $this->updateScoreAndExp(6); // 发送邮件 // ========================================================== $link = "http://tenniser.sinaapp.com/index.php/Invitation/invite_detail?type=" . $_POST['type'] . "&id=" . $_POST['id'] . "#" . $result; $mail = new SaeMail(); //$mail->setAttach( array("my_photo.jpg" => "照片的二进制数据" )); $ret = $mail->quickSend($userList[$_POST['user_id']]['mailbox'], "网动青春约球回复", "尊敬的用户:\n 您好!球友 " . $_SESSION['tennis-user']['username'] . " 在您的约球贴中回复了您哟~\n 内容如下:" . $data['comment'] . "\n 访问此链接查看详情:" . $link . "\n \n \n \t\t\t爱网球,爱青春,你我同行。——网动青春", "*****@*****.**", "jjaazz901222"); $mail->clean(); // ========================================================== $this->success('回复成功!'); } else { $this->success('回复失败!'); } }
static function SmtpMail($from, $to, $subject, $message, $options = null, $bcc = array()) { /* settings */ if (!isset($options['subjectenc'])) { $options['subjectenc'] = 'UTF-8'; } if (!isset($options['encoding'])) { $options['encoding'] = 'UTF-8'; } if (!isset($options['contentType'])) { $options['contentType'] = 'text/plain'; } if ('UTF-8' != $options['encoding']) { $message = mb_convert_encoding($message, $options['encoding'], 'UTF-8'); } global $INI; /* get from ini */ $host = $INI['mail']['host']; $port = $INI['mail']['port']; $ssl = $INI['mail']['ssl']; $user = $INI['mail']['user']; $pass = $INI['mail']['pass']; $from = $INI['mail']['from']; $reply = $INI['mail']['reply']; $site = $INI['system']['sitename']; //SAE 邮件发送 $ishtml = $options['contentType'] == 'text/html'; if ($ishtml) { $ContentType = 'HTML'; } else { $ContentType = 'TEXT'; } $options = array('to' => $to, 'subject' => $subject, 'content' => $message, 'content_type' => $ContentType, 'smtp_username' => $user, 'smtp_password' => $pass, 'from' => $from); $mail = new SaeMail($options); $ret = $mail->Send(); //发送失败时输出错误码和错误信息 if ($ret === false) { sae_debug($mail->errmsg()); } $mail->clean(); return $ret; /* $subject = self::EscapeHead($subject, $options['subjectenc']); $site = self::EscapeHead($site, $options['subjectenc']); $body = $message; $ishtml = ($options['contentType']=='text/html'); //begin $mail = new PHPMailer(); $mail->IsSMTP(); $mail->CharSet = $options['encoding']; $mail->SMTPAuth = true; $mail->Host = $host; $mail->Port = $port; if ( $ssl=='ssl' ) { $mail->SMTPSecure = "ssl"; } else if ( $ssl == 'tls' ) { $mail->SMTPSecure = "tls"; } $mail->Username = $user; $mail->Password = $pass; $mail->SetFrom($from, $site); $mail->AddReplyTo($reply, $site); foreach($bcc AS $bo) { $mail->AddBCC($bo); } $mail->Subject = $subject; if ( $ishtml ) { $mail->MsgHTML($body); } else { $mail->Body = $body; } $mail->AddAddress($to); return $mail->Send(); */ }
public function getBackPasswordSubmit() { $mailbox = $_POST['mailbox']; $condition['mailbox'] = $mailbox; $User = M('User'); $result = $User->where($condition)->getField("mailbox, password"); if ($result) { $mail = new SaeMail(); //$mail->setAttach( array("my_photo.jpg" => "照片的二进制数据" )); $ret = $mail->quickSend($mailbox, "网动青春密码找回", "尊敬的用户:\n 您好!这是您网动青春官方网站的账户密码(" . $result[$mailbox] . "),请妥善保管,如有必要可在用户中心进行修改。感谢您的支持与关注!\n \n \t\t\t爱网球,爱青春,你我同行。——网动青春", "*****@*****.**", "jjaazz901222"); $mail->clean(); if ($ret === false) { var_dump($mail->errno(), $mail->errmsg()); } else { $this->success('发送成功,请注意查收!', '/'); } } else { $this->error('该邮箱未注册!'); } }
public function verify() { $res = array(); $res['Success'] = false; $str = ''; $project = new Project(); $project->setValue($this->ProjectId); if ($this->Action > 0) { $keys = array(); //邮件设置 $verifyUrl = URL_WEBSITE . "/basic/project_detail.php?id=" . $project->Id . "&selected=2"; switch ($project->Status) { case 1: if ($this->Action == 1) { $project->Status = 2; $str = '需求审核通过;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['cc'] = "*****@*****.**"; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已通过事业部审核:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,已经通过事业部审核。接下来的环节是技术部的审核。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } else { $project->Status = 18; $str = '需求驳回;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,事业部审核不通过,已被驳回。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 2: if ($this->Action == 1) { $project->Status = 3; $str = '开发审核通过;'; $project->Developer = $this->Developer; $developer = new Developer(); //单独设置开发人员 //$this->DeveloperIds; //删除原来的。 $developer->deleteByProjectId($project->Id); //分割插入 $arrIds = explode(' ', $this->DeveloperIds); for ($i = 0; $i < count($arrIds); $i++) { $developer->ProjectId = $project->Id; $developer->UserId = $arrIds[$i]; if (empty($developer->UserId)) { continue; } $developer->add(); } //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已通过技术部审核:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,已经通过技术部审核。本次开发对接人为:" . $this->Developer . ",如有疑问,可与其联系。接下来是设计环节,客户确认好设计稿之后,请及时到以下链接更新项目状态:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } else { $project->Status = 19; $str = '开发需求驳回;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您的技术开发需求已被驳回:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,技术部审核不通过,已被驳回。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 3: if ($this->Action == 1) { $project->Status = 4; $str = '客户已确认设计稿;'; //设置发送邮件 //发送邮件操作 $keys['to'] = '*****@*****.**'; $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "设计稿客户已经确认:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,设计已经完成,可进入开发阶段。详情请点击:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } break; case 4: if ($this->Action == 1) { $project->Status = 5; $str = '开发已完成;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email']; $keys['from'] = "*****@*****.**"; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "您提交的技术开发需求,已经开发完成:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,您提交的技术开发需求,技术已开发完成,可以进入测试阶段。请安排人协助测试验收。如有问题请及时反馈给相关开发人员。测试完毕,请到以下链接及时更改为上线状态:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 5: if ($this->Action == 1) { $project->Status = 6; $str = '测试已完成;'; //设置发送邮件 $user = new User(); $userMode = $user->getModel($project->UserId); if (!empty($userMode['Email'])) { //发送邮件操作 $keys['to'] = $userMode['Email'] . ';sauweweng@thindov.com'; if ($project->Department == 101) { //大客户事业部需要抄送 $keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com'; } $keys['from'] = "*****@*****.**"; $keys['smtp_port'] = "25"; $keys['smtp_username'] = "******"; $keys['smtp_password'] = "******"; $mailsubject = "测试已经完成,活动已上线:" . $project->Subject; $mailbody = "Dear " . $userMode['Name']; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "您好,测试已经完成,活动已经上线。请在活动结束时及时到以下链接更新状态,并做效果的总结登记:"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "——深圳尚道微营销有限公司 技术中心"; $mailbody .= "<br />"; $mailbody .= "<br />"; $mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。"; $keys['subject'] = $mailsubject; $keys['content'] = $mailbody; $keys['content_type'] = 'HTML'; $keys['smtp_host'] = "smtp.qq.com"; } } break; case 6: if ($this->Action == 1) { $project->Status = 7; $str = '项目已经结束;'; } break; } $project->update(); } else { $project->Developer = $this->Developer; $developer = new Developer(); //单独设置开发人员 //$this->DeveloperIds; //删除原来的。 $developer->deleteByProjectId($project->Id); //分割插入 $arrIds = explode(' ', $this->DeveloperIds); for ($i = 0; $i < count($arrIds); $i++) { $developer->ProjectId = $project->Id; $developer->UserId = $arrIds[$i]; if (empty($developer->UserId)) { continue; } $developer->add(); } $project->update(); } $memo = new Memo(); $memo->ProjectId = $this->ProjectId; $memo->CreateTime = date('Y-m-d H:i:s'); $memo->Memo = $str . $this->Memo; $memo->UserId = $_SESSION['userid']; $result = $memo->add(); if ($result > 0) { $res['Success'] = true; $res['Message'] = "保存成功"; $res['Memo'] = $memo->Memo; $res['Name'] = $_SESSION['username']; $res['CreateTime'] = $memo->CreateTime; $res['NewId'] = $result; $res['Status'] = $project->Status; //发送邮件 $mail = new SaeMail(); $mail->setOpt($keys); $ret = $mail->send(); //if ($ret === false) //var_dump($mail->errno(), $mail->errmsg()); $mail->clean(); } else { $res['Success'] = false; $res['Message'] = "操作失败,请联系技术部"; } echo json_encode($res); exit; }