在Gmail中发送邮件时出现SSL3_GET_SERVER_CERTIFICATE错误


SSL3_GET_SERVER_CERTIFICATE error when sending mail in Gmail Codeigniter 3?

大家好,我告诉大家我正在使用XAMPP for utilzando apache module for PHP开发5.6版本

在我的情况下,我试图发送邮件到Gmail,但它正在生成以下类型的错误:SSL3_GET_SERVER_CERTIFICATE

PHP代码:

$config = array();
// The mail sending protocol.
$config['protocol'] = 'smtp';
// SMTP Server Address for Gmail.
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
// SMTP Port - the port that you is required
$config['smtp_port'] = 465;
// SMTP Username like. (abc@gmail.com)
$config['smtp_user'] = 'mailtest123@gmail.com';
// SMTP Password like (abc***##)
$config['smtp_pass'] = 'test123';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = true;
$config['newline'] = "'r'n"; //use double quotes to comply with RFC 822

// Load email library and passing configured values to email library
$this->load->library('email', $config);
$this->email->from('hernando123@gmail.com', 'Hernando');
$this->email->to('hernando567@gmail.com'); 
$this->email->subject('TEST SEND 09-10');
$this->email->message('TEST SEND 09-10 LLLLL.');
if ($this->email->send()) {
    log_message('debug', '-----> Mail Sent!');
} else {
    log_message('debug', '-----> There is error in sending mail!');
}

错误PHP:

ERROR - 2015-10-09 03:46:45 --> Severity: Warning --> fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed C:'xampp'htdocs'accounts'system'libraries'Email.php 1949
ERROR - 2015-10-09 03:46:45 --> Severity: Warning --> fsockopen(): Failed to enable crypto C:'xampp'htdocs'accounts'system'libraries'Email.php 1949
ERROR - 2015-10-09 03:46:45 --> Severity: Warning --> fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error) C:'xampp'htdocs'accounts'system'libraries'Email.php 1949
DEBUG - 2015-10-09 03:46:45 --> -----> There is error in sending mail!

根据我的研究,在这个页面上:https://kamihouse.wordpress.com/2015/01/05/verificacao-de-certificado-ssl-com-php-5-6/

添加一个文件夹XAMPP wing,然后映射到php.ini

openssl.cafile = "C:'xampp'ssl'cert.pem"
http://es.tinypic.com/r/jt9vyv/8

但是我的工作不一样,我希望你能帮助我的情况,谢谢。

尝试在$config setting之前加载电子邮件库

 $this->load->library('email');
   $config=array(
            'charset'=>'utf-8',
            'wordwrap'=> TRUE,
            'mailtype' => 'html'
            );
$this->email->initialize($config);

您正在中间加载库。想了解更多,试试这个教程http://w3code.in/2015/09/how-to-send-email-using-codeigniter/

我在这篇文章中找到了答案: http://punto50.blogspot.pe/2015/03/envio-de-correo-con-phpmailer-y-gmail.html