GMail fsockopen():使用 Codeigniter 和 XAMPP 的 SSL 操作失败错误 [英] GMail fsockopen(): SSL operation failed error with Codeigniter and XAMPP

查看:11
本文介绍了GMail fsockopen():使用 Codeigniter 和 XAMPP 的 SSL 操作失败错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误消息 1:消息:fsockopen():SSL 操作失败,代码为 1.OpenSSL 错误消息:错误:14090086:SSL 例程:ssl3_get_server_certificate:certificate verify failed

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

文件名:libraries/Email.php

Filename: libraries/Email.php

行号:1962

错误消息 2:消息:fsockopen():无法启用加密错误消息 3:消息:fsockopen(): 无法连接到 >ssl://smtp.gmail.com:465(未知错误)

Error message 2: Message: fsockopen(): Failed to enable crypto Error message 3: Message: fsockopen(): unable to connect to >ssl://smtp.gmail.com:465 (Unknown error)

php.ini: extension=php_openssl.dll ->未注释我试过: openssl.cafile= C:xamppperlvendorlibMozillaCAcacert.pem我试过禁用防火墙我已尝试使用另一个网络

php.ini: extension=php_openssl.dll -> uncommented I have tried with: openssl.cafile= C:xamppperlvendorlibMozillaCAcacert.pem I have tried with disabled firewall I have tried with another network

Codeigniter PHP 代码:

Codeigniter PHP Code:

$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("
");

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

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

    $this->email->send();

推荐答案

在我的例子中,Avast Antivirus 阻止了端口.我使用 SMTP 端口 465 从我的 CodeIgniter 项目发送电子邮件.它显示了一个错误:

In my case, the Avast Antivirus was blocking the port. I was using the SMTP port 465 for sending an email from my CodeIgniter project. It showed an error:

fsockopen() 未能启用加密

只需禁用 Avast Antivirus 即可解决问题.

Simply disabling the Avast Antivirus solved the problem.

但如果您想保持 Avast 安全,您应该:

But if you want to keep your Avast security on, you should:

  • 打开 Avast

  • Open Avast

点击设置(页面右上角)

点击疑难解答

点击重定向设置

重定向设置MAIL部分清除您使用的端口

Clear the port you used from Redirect Settings's MAIL section

点击确定

关闭 Avast

这篇关于GMail fsockopen():使用 Codeigniter 和 XAMPP 的 SSL 操作失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆