From 0267cb856237ae3ffb403d60890a0f1a01da08c2 Mon Sep 17 00:00:00 2001 From: cyc Date: Tue, 17 Mar 2020 14:29:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=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 | 54 +++++-------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/webht/third_party/dingmail/controllers/index.php b/webht/third_party/dingmail/controllers/index.php index 1ec075e6..9a14123a 100644 --- a/webht/third_party/dingmail/controllers/index.php +++ b/webht/third_party/dingmail/controllers/index.php @@ -123,7 +123,15 @@ class Index extends CI_Controller { } //收件人 - $tomail = 'all@hainatravel'; + $tostring = ''; + + $tostring = substr($data['mail_touser'],0,-1); + + if(!empty($tostring)){ + $tomail = $this->ding_value_model->all_email($tostring); + }else{ + $tomail = null; + } //抄送 $ccstring = ''; @@ -239,46 +247,8 @@ class Index extends CI_Controller { //执行邮件发送功能 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 - $mail->Port = 465; - $mail->SMTPAuth = true; - $mail->SMTPSecure = false; - $mail->Username = 'admin@hainatravel.com'; - $mail->Password = "Guilinhaina2019";//Hainatravel1234 - $mail->SMTPSecure = 'ssl'; - $mail->CharSet = "utf-8"; - $mail->Encoding = "base64"; - $mail->IsHTML(true); - $mail->SMTPOptions = array( - 'ssl' => array( - 'verify_peer' => false, - 'verify_peer_name' => false, - 'allow_self_signed' => true - ) - ); - //$mail->SMTPDebug = 2; - - $mail->FromName = $fromuser; //收件人昵称 - $mail->From = 'admin@hainatravel.com'; //发件人 - //$mail->setFrom('zm198311@yahoo.com.cn‍', $fromuser); - - $mail->AddAddress($tomail); - - $mail->Subject = $subject; //邮件主题 - $mail->Body = $mailbody; //邮件内容 - - if (!$mail->Send()) { - $result = $mail->ErrorInfo; - echo "邮件发送有误: " . $mail->ErrorInfo; - } else { - $result = true; - } - return $result; - /*require 'email.class.php'; - $mailto = 'all@hainatravel.com'; + require 'email.class.php'; + $mailto = $tomail; $mailsubject = $subject; $mailbody = $mailbody; $smtpserver = "smtp.qiye.aliyun.com"; @@ -299,7 +269,7 @@ 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() {