0

My project is using Codeigniter and XAMPP. I have used the Codeigniter's email library on PC1 when I started to develop the application. Everything went fine but when I copied the htdocs directory to PC2 at the e-mail sending function says:

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

and

Message: fsockopen(): Failed to enable crypto

and

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

I think my e-mail sending function is ok:

$config = Array(
        'protocol'  => 'smtp',
        'smtp_host' => 'ssl://smtp.gmail.com',
        'smtp_port' => 465,
        'smtp_user' => 'asd@gmail.com',
        'smtp_pass' => 'asd',
        'mailtype'  => 'html',
        'charset'   => 'utf-8'
    );

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

    $this->email->from('asd@gmail.com', 'asd');
    $this->email->to($c);

    $this->email->subject($a);
    $this->email->message($b);

    $this->email->send();

I have tried many things but it did not work. I think the problem is with the certificate file. How should I set up my certificate and how should I add to the config file? Please give me a detailed manual.

V. Mark
  • 195
  • 2
  • 4
  • 14
  • Possible duplicate of [CodeIgniter and Gmail SMTP Timeout with SSL scoket](http://stackoverflow.com/q/3422935), [OPENSSL file_get_contents(): Failed to enable crypto](http://stackoverflow.com/q/14078182/608639), [Error with fsockopen() and SSL, 'Failed to enable crypto'](http://stackoverflow.com/q/5498497), [fsockopen ssl connection not working](http://stackoverflow.com/q/15612147), etc. – jww Jan 03 '16 at 15:03
  • I don't think so. I have tried almost everything. – V. Mark Jan 03 '16 at 15:12

1 Answers1

0

I used this couple of years back

$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => ' user@gmail.com',
        'smtp_pass' => ' pass',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
        );
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('user@gmail.com', 'User Name');
$this->email->to('to@abc.com');

$this->email->subject('Subject');
$this->email->send();
Shantanu
  • 692
  • 5
  • 20