1

Codeigniter Email Class is not working on localhost

Errors

  1. Message: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

  2. Message: fsockopen(): Failed to enable crypto

  3. Message: fsockopen():unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)


public function index()
{
    $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '[email protected]',
        'smtp_pass' => '********', 
        'mailtype' => 'html',
        'charset' => 'iso-8859-1',
        'wordwrap' => TRUE
    );

    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
    $this->email->from('[email protected]');
    $this->email->to('[email protected]');
    $this->email->subject('Test');
    $this->email->message("This is test of codeigniter email class.");

    if($this->email->send())
    {
        echo 'Email sent.';
    }
    else
    {
        show_error($this->email->print_debugger());
    }

}

0 Answers0