无法加载请求的类:电子邮件

时间:2015-06-01 11:50:13

标签: php codeigniter email

该脚本在我的localhost(Xampp,mac lion)中完美运行。将网站上传到免费的远程主机http://cp1.runhosting.com/以及我的脚本尝试使用它给出此错误的电子邮件类的所有部分(在标题中提到)。有什么想法吗?

//send_email_helper

 function send_email($user_email,$subject,$msg){

   $i = & get_instance();

      $config = Array(
                    'protocol' => 'smtp',
                    'smtp_host' => 'ssl://smtp.googlemail.com',
                    'smtp_port' => 465,
                    'smtp_user' => 'myemail@gmail.com', 
                    'smtp_pass' => 'mypassword', 
                    'mailtype' => 'html',
                    //'charset' => 'iso-8859-1',
                    'charset' => 'utf-8',
                    'wordwrap' => TRUE
                  );

     $i->load->library('email', $config);
     $i->email->set_newline("\r\n");

    $i->email->from('myemail@gmail.com','My Name');
    $i->email->to($user_email);
     $i->email->subject($subject);


     $i->email->message($msg);

     if($i->email->send()){
         return true;
     }else{
         return false;
     }





}




 //function call in controller
function process(){
      $this->load->helper('send_email_helper');
      $user_email = $this->filterdata($this->input->post('email'));
      $message = "test message blah blah...";
      $subject = "test subject";
      $data['email_sent'] = false;

          if(send_email($user_email,$subject,$message)){

              $data['email_sent'] = true;

          }else{
             $data['email_sent'] = false;
           } 

           $data['chat_client'] = $this->session->userdata('chat_client');

         $this->load->view('confirmation',$data);

}

2 个答案:

答案 0 :(得分:0)

在下面说明,这可能是个问题。

// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newWebSite.com/");
exit();

了解详情: here

答案 1 :(得分:0)

刚刚注意到库文件夹中的一些CI系统文件因某些原因未被复制到远程主机,包括(email.php)。上传丢失的文件一切正常。感谢大家的帮助,对不起浪费你的时间。