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() {