php - sending mai is not working in forget password api -
it show success message mail sent mail dint revive mail. how can config should define stp variable? using in ci api send mail please help
public function forgotpass_post() { $email = trim($this->post('email')); //print_r($email);exit; try{ else{ //print_r($email);exit; $user_data = $this->basic->get_record_by_id('tbl_user', array('email'=>$email)); //print_r($this->basic->get_record_by_id('tbl_user',array('email'=>$email)));exit; if($user_data){ $user_name = $this->basic->get_record_by_id('tbl_user',array('id'=>$user_data[0]['id'])); $this->load->helper('string'); $password = random_string('alnum',6); $id=$user_data[0]['id']; //update password $update_password = $this->basic->updatepass('tbl_user',['password'=>$this->bcrypt->hash_password($password)],$id); //send email new password $data['email'] = $email; $data['password'] = $password; $message = $this->load->view('api/new_password_mail', $data, true); $config['mailtype'] = 'html'; $this->email->initialize($config); $this->email->from('noreply@telecomiot.com', 'password recovery'); $this->email->to($email); $this->email->subject('password recovery'); $this->email->message($message); $send = $this->email->send(); $send = true; $this->email->clear(); $response_data['responsecode'] = '200'; $response_data['responsemessage'] = 'an email has been sent email address. follow directions in email reset password.'; $this->response($response_data, rest_controller::http_ok); }
how send mail using email library
Comments
Post a Comment