GMail fsockopen():使用 Codeigniter 和 XAMPP 的 SSL 操作失败错误

2024-04-12php开发问题
37

本文介绍了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 操作失败错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17