Codeigniter发送电子邮件OpenSSL错误


Codeigniter send email OpenSSL error

我在发送电子邮件时遇到问题。我不知道该怎么办。我已经取消了对php.ini文件中扩展名=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(未知错误)

我已经解决了这个问题。我刚刚关闭了防病毒软件(Avast)。

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

fsockopen()无法启用加密

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

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

  • 打开Avast

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

  • 单击故障排除

  • 单击重定向设置

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

  • 单击确定

  • 关闭Avast

我在nginx服务器上遇到了同样的问题。已将OpenSSL升级到1.1.1,但仍保持不变。在我的笔记本电脑上,我使用卡巴斯基,但在我的情况下,防病毒不会在服务器上产生任何问题。