SMTP Gmail error with Codeigniter 2.1.3

后端 未结 1 784
猫巷女王i
猫巷女王i 2021-01-15 07:36

i have seen many post related to this problems, i have done the instruction given but always get the same error..

I want to send smtp gmail using Code Igniter 2.1.3,

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 08:30

    You need to enable your ssl in php.ini file in your server configuration and you can check whether it is enabled or not if you are using Xampp server. In that go to PHP info search for ssl.........

    You need to remove ; before extension=php_openssl.dll this line in php.ini file.

    You need to enable OpenSSL........

    I faced this error recently.There is a small mistake in your code........

    function sendMail()
    {
        $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => 'xxx@gmail.com', // change it to yours
      'smtp_pass' => 'xxx', // change it to yours
      'mailtype' => 'html',
      'charset' => 'iso-8859-1',
      'wordwrap' => TRUE
    );
    
            $message = $this->load->view('upload_success','',TRUE);
            $this->load->library('email', $config);
          $this->email->set_newline("\r\n");
          $this->email->from('xxx@gmail.com'); // change it to yours
          $this->email->to('yyy@gmail.com');// change it to yours
          $this->email->subject('Resume from JobsBuddy for your Job posting');
          $this->email->message($message);
          if($this->email->send())
         {
          echo 'Email sent.';
         }
         else
        {
         show_error($this->email->print_debugger());
        }
    
    }
    

    This is a working code which i am using after i solved the problem which u r facing.....

    0 讨论(0)
提交回复
热议问题