【问题标题】:Unable to load the requested class: email无法加载请求的类:电子邮件
【发布时间】:2015-06-01 11:50:12
【问题描述】:

该脚本在我的本地主机(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);

}

【问题讨论】:

  • 你在哪里加载你的电子邮件库??在您的代码中向我们展示!
  • 刚刚编辑了问题

标签: php codeigniter email


【解决方案1】:

下面正确,可能是这个问题。

$i =& get_instance();

阅读全文: here

【讨论】:

    【解决方案2】:

    刚刚注意到库文件夹中的一些 CI 系统文件由于某种原因没有复制到远程主机,包括(email.php)。上传丢失的文件一切都按预期工作。感谢大家的帮助,也很抱歉浪费了您的时间。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-30
      • 2013-02-10
      • 2018-06-07
      • 2011-12-23
      • 2013-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多