Esempio n. 1
0
 function send()
 {
     if ($this->tpl_name) {
         include_once '../tf_app/template_/Template_.class.php';
         $tpl = new Template_();
         $tpl->define('mail', 'views/mail/' . $this->tpl_name . '.tpl');
         $tpl->assign($this->assigns);
         $this->content = $tpl->fetch('mail');
     }
     /*
     $subject=iconv("UTF-8", "EUC-KR", $subject);
     $content=iconv("UTF-8", "EUC-KR", $content);
     */
     if (!$this->sender_name) {
         $this->sender_name = $this->settings->sender_name;
     }
     if (!$this->sender_password) {
         $this->sender_password = $this->settings->sender_password;
     }
     if (!$this->mailto) {
         $this->mailto = $this->settings->mailto;
     }
     if (!$this->server) {
         $this->server = $this->settings->server;
     }
     if (!$this->sender_user) {
         $this->sender_user = $this->settings->sender_user;
     }
     if (!$this->sender_address) {
         $this->sender_address = $this->settings->sender_address;
     }
     require_once '../tf_app/ext/phpmailer/class.phpmailer.php';
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->SMTPAuth = true;
     $mail->SMTPSecure = 'ssl';
     $mail->Host = $this->server;
     $mail->Port = 465;
     $mail->Username = $this->sender_user;
     $mail->Password = $this->sender_password;
     $mail->From = $this->sender_address;
     $mail->FromName = $this->sender_name;
     $mail->Subject = $this->subject;
     $mail->Body = $this->content;
     $mail->AddAddress($this->mailto);
     $mail->Send();
     // if(!$mail->Send())
     // {
     //    echo "Message could not be sent. <p>";
     //    echo "Mailer Error: " . $mail->ErrorInfo;
     //    exit;
     // }
     //            $mail_log = load_model("Tb_log");
     //            $mail_log->add('email', $this->mailto);
 }
Esempio n. 2
0
 public function render()
 {
     include_once '../tf_app/template_/Template_.class.php';
     if ($this->tpl_name) {
         $tpl = new Template_();
         if (substr($this->tpl_name, 0, 2) == "//") {
             $tpl_location = "views" . substr($this->tpl_name, 1);
         } else {
             if ($this->_trail->_use_component) {
                 $tpl_location = "ext/" . $this->tpl_name;
             } else {
                 if (substr($this->tpl_name, 0, 1) == "/") {
                     $tpl_location = "views" . $this->tpl_name;
                 } else {
                     $tpl_location = "views/" . $this->_class_name . '/' . $this->tpl_name;
                 }
             }
         }
         $tpl->define('body', $tpl_location . ".tpl");
         $this->assigns["settings"] = $this->settings;
         $this->assigns["tpl_name"] = $this->tpl_name;
         $tpl->assign($this->assigns);
         $tpl->define($this->defines);
     }
     if ($this->layout) {
         $layout = new Template_();
         if (substr($this->layout, 0, 2) == "//") {
             $tpl_location = "views" . substr($this->layout, 1);
         } else {
             if ($this->_trail->_use_component) {
                 $tpl_location = "ext/" . $this->layout;
             } else {
                 if (substr($this->layout, 0, 1) == "/") {
                     $tpl_location = "views" . $this->layout;
                 } else {
                     $tpl_location = 'views/layouts/' . $this->layout;
                 }
             }
         }
         $layout->define('layout', $tpl_location . '.tpl');
         $this->assigns_layout["contents_for_layout"] = $tpl->fetch('body');
         $this->assigns_layout["settings"] = $this->settings;
         $layout->assign($this->assigns_layout);
         $layout->define($this->defines_layout);
         $layout->print_('layout');
     } else {
         if ($this->tpl_name) {
             $tpl->print_('body');
         }
     }
 }