gpt4 book ai didi

php - 在 Gmail Codeigniter 3 中发送邮件时出现 SSL3_GET_SERVER_CERTIFICATE 错误?

转载 作者:太空宇宙 更新时间:2023-11-03 15:08:59 24 4
gpt4 key购买 nike

社区大家好,我告诉他们我正在使用 XAMPP 为 5.6 版的 PHP 开发使用 utilzando apache 模块。

在我的例子中,我试图将邮件发送到 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 翼,和你映射在php.ini

openssl.cafile = "C:\xampp\ssl\cert.pem"

http://es.tinypic.com/r/jt9vyv/8

但我的工作不一样,希望你能帮我解决一下,谢谢。

最佳答案

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

 $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/

关于php - 在 Gmail Codeigniter 3 中发送邮件时出现 SSL3_GET_SERVER_CERTIFICATE 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33034170/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com