From 8968b1c719fe185133f7e32f9a3ae4be36c2c40e Mon Sep 17 00:00:00 2001 From: cyc Date: Tue, 17 Mar 2020 14:14:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6=E5=8F=91?= =?UTF-8?q?=E9=80=81=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dingmail/controllers/index.php | 53 ++++++------------- webht/third_party/dingmail/views/mail.php | 2 +- 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/webht/third_party/dingmail/controllers/index.php b/webht/third_party/dingmail/controllers/index.php index f86f8811..1ec075e6 100644 --- a/webht/third_party/dingmail/controllers/index.php +++ b/webht/third_party/dingmail/controllers/index.php @@ -123,21 +123,7 @@ class Index extends CI_Controller { } //收件人 - $tostring = ''; - $tolist_array = array(); - $nowlist_array = explode(';', $this->input->post('emaillist')); - foreach ($nowlist_array as $v) { - if($v != null){ - $tostring .= "'".$v."'".','; - } - } - $tostring = substr($tostring,0,-1); - if(!empty($tostring)){ - $tolist_array = $this->ding_value_model->all_email($tostring); - }else{ - $tolist_array = null; - } - + $tomail = 'all@hainatravel'; //抄送 $ccstring = ''; @@ -175,7 +161,11 @@ class Index extends CI_Controller { $body = $mailheader.$this->input->post('emailcontent'); } - if (!$this->do_sendmail($fromuser, $tolist_array, $cclist_array, $subject, $body)) { + //提交到其他服务器发送 + $url = 'https://cht.mycht.cn/webht.php/apps/dingmail/index/do_sendmail'.$fromuser.'/'.$tomail.'/'.$subject.'/'.$body; + $flag = $this->get_http($url); + + if (!$flag) { $result = 0; //"邮件发送有误: " . $mail->ErrorInfo; } else { //是value邮件的话,默认发送人点赞 @@ -238,11 +228,9 @@ class Index extends CI_Controller { // $mailnody .= '任职时间开始:'.$data['from_time'].'
'; // $mailnody .= '任职时间结束:'.$data['to_time'].'
'; - $tolist_array = array(); - $tolist_array['0'] = new stdClass(); - $tolist_array['0']->ddu_Email = 'hr@chinahighlights.net'; + $tomail = 'hr@chinahighlights.net'; - if($this->do_sendmail('cyc',$tolist_array,'','应聘简历',$mailnody)){ + if($this->do_sendmail('cyc',$tomail,'应聘简历',$mailnody)){ echo '{"status":1}'; }else{ echo '{"status":0}'; @@ -250,8 +238,8 @@ class Index extends CI_Controller { } //执行邮件发送功能 - public function do_sendmail($fromuser, $tolist_array, $cclist_array, $subject, $mailbody) { - /*$this->load->library('Phpmailer_lib'); + public function do_sendmail($fromuser, $tomail, $subject, $mailbody) { + $this->load->library('Phpmailer_lib'); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = 'smtp.mxhichina.com';//smtp.sendgrid.net @@ -277,16 +265,7 @@ class Index extends CI_Controller { $mail->From = 'admin@hainatravel.com'; //发件人 //$mail->setFrom('zm198311@yahoo.com.cn‍', $fromuser); - if($tolist_array != null){ - foreach ($tolist_array as $v) { - $mail->AddAddress($v->ddu_Email); //收件人 - } - } - if($cclist_array != null){ - foreach ($cclist_array as $c) { - $mail->addCC($c->ddu_Email); //抄送 - } - } + $mail->AddAddress($tomail); $mail->Subject = $subject; //邮件主题 $mail->Body = $mailbody; //邮件内容 @@ -297,9 +276,9 @@ class Index extends CI_Controller { } else { $result = true; } - return $result;*/ - require 'email.class.php'; - $mailto = 'admin@hainatravel.com'; + return $result; + /*require 'email.class.php'; + $mailto = 'all@hainatravel.com'; $mailsubject = $subject; $mailbody = $mailbody; $smtpserver = "smtp.qiye.aliyun.com"; @@ -320,12 +299,12 @@ class Index extends CI_Controller { $additional_headers = ""; //设置发件人名称,名称用户可以自定义填写。 $sender = "发件人"; - $smtp->sendmail($mailto,$smtpusermail, $mailsubject, $mailbody, $mailtype, $cc, $bcc, $additional_headers, $sender, $smtpreplyto); + $smtp->sendmail($mailto,$smtpusermail, $mailsubject, $mailbody, $mailtype, $cc, $bcc, $additional_headers, $sender, $smtpreplyto);*/ } public function do_sendmailtest() { require 'email.class.php'; - $mailto = 'admin@hainatravel.com'; + $mailto = 'cyc@hainatravel.com'; $mailsubject = '测试标题'; $mailbody = '测试内容'; $smtpserver = "smtp.qiye.aliyun.com"; diff --git a/webht/third_party/dingmail/views/mail.php b/webht/third_party/dingmail/views/mail.php index a4a3d696..f85a8dc5 100644 --- a/webht/third_party/dingmail/views/mail.php +++ b/webht/third_party/dingmail/views/mail.php @@ -76,7 +76,7 @@ - +