0

The script works perfectly in my localhost(Xampp,mac lion). Uploaded website to a free remote host http://cp1.runhosting.com/ and all parts where my script tries to use the email class it gives this error (mentioned on title). Any ideas?

//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);

}
sunrisepoet
  • 107
  • 11

2 Answers2

0

Correct below, probably this might be the issue.

$i =& get_instance();

Read more: here

Community
  • 1
  • 1
Parag Tyagi
  • 8,780
  • 3
  • 42
  • 47
0

Just noticed that some of CI system files from the library folder where not copied to remote host for some reason including(email.php). uploaded the missing files everything is working as intended. Thanks everyone for your help, and sorry for wasting your time.

sunrisepoet
  • 107
  • 11