0

I have a problem with smtp gmail using codeigniter 3, I created this code in the controller folder with the file name Auth.php. so when the user clicks the register button a verification email will be sent to the email that was registered by the user

`   private function _sendEmail()
    { 
        $config = [
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_users' => '***',
            'smtp_pass' => '***',
            'smtp_port' =>  465,
            'mailtype' => 'html',
            'charset' => 'utf-8',

        ];

        $this->email->set_newline("\r\n");
        $this->load->library('email',$config); 
        $this->email->initialize($config);

        $this->email->from('Email Sender', 'Full name in email');
        $this->email->to('Recieved email');
        $this->email->subject('Testing');
        $this->email->message('coba coba');

        if($this->email->send()) {
            return true;
        } else {
            echo $this->email->print_debugger();
            die;
        }
    }`
2
  • 1
    Did you forget to finish your post? You can edit it. See also How to Ask. If you have a problem, you need to tell us specifically what that problem is, explain what investigation and attempts to fix it you've made so far, and ensure you provide a minimal reproducible example of the issue including relevant code, any error messages, relevant log entries etc which might help to diagnose the issue. At the moment, all we know is you have an unspecified "problem" - clearly that is not going to be something we can meaningfully help you with. Thanks. Commented Jul 19, 2023 at 10:10
  • I think smtp host is smtp.gmail.com Commented Jul 27, 2023 at 14:23

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.