I am trying to implement an email verification after registering an account. So after registering an account, an email will be sent to the user email to verify. the email was sent using the email class of codeigniter.
The code for sending the email is as below
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('admin@mathplication.com', 'admin');
$this->email->to($user_email);
$this->email->subject('Registration verification for mathplication');
$this->email->message('
Thanks for signing up!
Your account has been created, you can login with the following credentials
after you have activated your account by pressing the url below.
Please click this link to activate your account:
<a href='.base_url('verify').'?email='.$user_email.'&rand='.$user_rand.'>Click Here</a>');
$this->email->send();
and in the routes.php in the config folder
$route['verify'] = "login_register/view_verify
in which view_verify is the function in my login_register controller
inside this view_verify I will check the two parameters I passed which are the email and the random string generated.
function view_verify($email,$rand)
{
//$email = $this->input->get('email');
//$rand = $this->input->get('rand');
$this->load->database();
$this->load->model('login_model');
$result= $this->login_model->email_verification($email,$rand);
if($result==TRUE)
{
$this->load->view('pages/verify');
}
}
I will get a 404 page not found error. Not sure if my routing with the variables is the problem here or not or is there another way of passing parameters through url to the controller. Thanks in advance for the help.