0

this is my code for email sending but it is not working ,it shows no error but email sending is not working.

function resetPasswordUser()
    {
    $this->load->view('forgotPassword');
    $username=$this->input->post('username');
    $email=$this->Dashboard_model->forgetPassword($username);     print_r($email);
    $config = array(
            'protocol'=>'smtp',
            'smtp_host'=>'ssl://smtp.googlemail.com',
            'smtp_port'=>465,
            'smtp_user'=>'xxxxxx',
            'smtp_pass'=>'xxxxx'
        );

        $this->load->library('email',$config);

        $this->email->set_newline("\r\n");
        $this->email->from('ankittiwari.rps@gmail.com', "My Name");
        $this->email->to($email);
        $this->email->subject('Test');
        $this->email->message('enter on the following link');
        $this->email->send();
        $msg=$this->email->print_debugger();
        print_r($msg);
    }
  • Did you check your mail settings connection with your provider or localhost? The code seems to be fine. – Ankur Sinha Aug 06 '18 at 07:43
  • can you please guide me that what are the settings that require to send email – Aankit Tiwari Aug 06 '18 at 07:45
  • 1
    did you properly install and setup smtp in your localhost? please refer here https://stackoverflow.com/questions/15267423/php-send-mail-in-localhost – Beginner Aug 06 '18 at 07:47
  • Remove the `ssl://` from the hostname (hostnames do not include a protocol) and change the port to 587. – Striezel Aug 06 '18 at 09:45

1 Answers1

1

I believe you are connecting incorrectly.

For Gmail servers the host is smtp.gmail.com and the port is 587.

Aliics
  • 129
  • 6