【问题标题】:Codeigniter send email OpenSSL errorCodeigniter 发送电子邮件 OpenSSL 错误
【发布时间】:2016-09-02 05:10:48
【问题描述】:

我在发送电子邮件时遇到问题。我不知道该怎么办。我已经取消注释 php.ini 文件中的 extension=php_openssl.dll,但我仍然收到此错误。

这是我的代码:

function send_email(){
        $config = array(
            'protocol' => 'smtp',
            'smtp_host' => 'ssl://smtp.googlemail.com',
            'smtp_port' => '465',
            'smpt_timeout' => '30',
            'smtp_user' => 'example@gmail.com',
            'smtp_pass' => $pass,
            'charset' => 'utf-8',
            'newline' => "\r\n"
        );


        $this->load->helper('string');
        $this->load->library('email',$config);

        $this->email->from('example@yahoo.com', 'Mr. Duterte');
        $this->email->to('example2@yahoo.com');

        $this->email->subject('DU30');
        $this->email->message('change is coming');
        //.base_url().'item/'.random_string

       if( $this->email->send()){
           echo "Success";
       }else{
           echo "Fail";

       }
    }

我收到三个错误:

第一:

"fsockopen(): SSL 操作失败,代码为 1。OpenSSL 错误 消息:错误:14090086:SSL 例程:ssl3_get_server_certificate:证书验证失败”

第二:

fsockopen(): 启用加密失败

第三:

fsockopen(): 无法连接到 ssl://smtp.googlemail.com:465 (未知错误)

【问题讨论】:

标签: php codeigniter email ssl


【解决方案1】:

我已经找到了问题所在。我刚刚关闭了我的防病毒软件 (Avast)。

【讨论】:

    【解决方案2】:

    Avast Antivirus 阻止了该端口。我使用 SMTP 端口 465 从 CodeIgniter 项目发送电子邮件:

    fsockopen() 未能启用加密

    只需禁用 Avast Antivirus 解决了问题

    另一种解决方案,但如果您想保持 Avast 安全,您应该:

    • 打开 Avast

    • 点击设置(页面右上角)

    • 点击疑难解答

    • 点击重定向设置

    • 重定向设置的邮件部分清除您使用的端口

    • 点击确定

    • 关闭 Avast

    【讨论】:

    • 第一个解决方案是成功的,但是替代解决方案不再有效,因为 Avast 应用程序已更新其 UI 并且不再存在(Avast 版本:20.10.2442)
    猜你喜欢
    • 2015-03-17
    • 2016-05-06
    • 2013-01-07
    • 2019-08-07
    • 1970-01-01
    • 1970-01-01
    • 2018-05-24
    • 2012-12-16
    • 2015-04-09
    相关资源
    最近更新 更多