0

Hello Stack Overflow community,

I'm encountering an issue in my PHP-based LMS system where email verification codes are not being sent successfully during user registration. Here are the key details:

  • PHP Version: 7.3.9
  • Email Sending Method: SMTP

During user registration, a verification code is generated, but the email with the code is not reaching the user's inbox. Below is a simplified version of the relevant PHP code:

Controller - Admin:

public function smtp_settings($param1 = "")
{
        public function smtp_settings($param1 = "")
    {
        if ($this->session->userdata('admin_login') != true) {
            redirect(site_url('login'), 'refresh');
        }

        // CHECK ACCESS PERMISSION
        check_permission('settings');

        if ($param1 == 'update') {
            $this->crud_model->update_smtp_settings();
            $this->session->set_flashdata('flash_message', get_phrase('smtp_settings_updated_successfully'));
            redirect(site_url('admin/smtp_settings'), 'refresh');
        }

        $page_data['page_name'] = 'smtp_settings';
        $page_data['page_title'] = get_phrase('smtp_settings');
        $this->load->view('backend/index', $page_data);
    }
}
2
  • You know your code very well, and it seems you assume we do as well. We should also know what an "LMS" system is, even though that's not relevant for the question. And, of course, the little code snippet, with its obvious errors, but without any extra information, should be enough for us to know what the problem is. To be honest, if you hadn't told me that that code was sending out an email, I would have never guessed it. What I mean is that we can only help you if you give us the information to understand what the problem is. See: how-to-ask. Commented Oct 5, 2023 at 7:04
  • To be slightly more helpful: There are many reasons why an email doesn't reach the user's inbox. A good start are the answers to this question: PHP mail function doesn't complete sending of e-mail. Most items mentioned there are useful for any method of sending email. Commented Oct 5, 2023 at 7:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.