I've a registration form and and want to send email to "To Email" and at the same time want to insert user record in db , insertion is successfull but email is not sending using codeigniter here is my code snippet from model and controller resp.
model:
 public function add_user()
 {
  $data=array(
    'username'=>$this->input->post('user_name'),
      'first_name' =>  $this->input->post('fname'),
      'last_name' =>  $this->input->post('lname'),
    'email'=>$this->input->post('email_address'),
    'password'=>md5($this->input->post('password'))
  );
  return  $this->db->insert('user',$data);
  //return $data;
 }
and here is controller code:
 $this->user_model->add_user();
 $this->thank();
  $config = Array(      
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
                'smtp_port' => 465,
        'smtp_user' => 'abc@gmail.com',
                'smtp_pass' => '******',
        'smtp_timeout' => '4',
        'mailtype'  => 'text', 
        'charset'   => 'iso-8859-1'
    );
        $this->load->library('email',$config);
        $this->email->from('mubbashir.azez@gmail.com');
        $this->email->to($data['Email']);
        $this->email->subject('test subject');
        $this->email->message('hello CI');
        $this->email->send();
        echo $this->email->print_debugger();
here is view code:
  
  ', '
No comments:
Post a Comment