gimana cara config email class

gimana sih caranya config email class nya codeigniter dengan gmail nya kita ?

       $this->load->library('email');
      $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '*****',
        'smtp_pass' => '****',
        'charset'   => 'iso-8859-1'
      );

      $mesg = $this->load->view('email','',true);

      $this->email->initialize($config);

      // set from, to, subject

      $this->email->send();

saya udah coba gini dapet error :

Message: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

avatar cahyo911
@cahyo911

42 Kontribusi 8 Poin

Diperbarui 6 tahun yang lalu

1 Jawaban:

$config = array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'tes@gmail.com', 'smtp_pass' => '*****', 'mailtype' => 'html', 'charset' => 'utf-8' ); $this->email->initialize($config); $this->email->set_mailtype("html"); $this->email->set_newline("\r\n"); $this->email->to($to); $this->email->cc($cc); $this->email->from('tes@gmail.com'); $this->email->subject($subject); $this->email->message($message); $this->email->send();

avatar malili
@malili

6 Kontribusi 0 Poin

Dipost 6 tahun yang lalu

Login untuk ikut Jawaban