phpMailer证书验证失败

问题描述

我在Windows 10上使用XAMPP,我的网站使用Yii 1框架,并托管在亚马逊上,我在使用gsuite作为公司电子邮件。为了允许使用我的域发送电子邮件,我还使用了Amazon SES。

这是我发送电子邮件的代码。它可以实时运行,但不能在本地运行

                $mail = new YiiMailer();

                $mail->clearLayout();//if layout is already set in config
                $mail->setViewPath('application.views.mail');
                $mail->setFrom(Yii::app()->params['adminEmail'],$model->firstname.' '.$model->lastname);
                $mail->setTo($model->email);
                $mail->setSubject('Contact Us Question');

                if (YII_DEBUG) {
                    $mail->SMTPOptions = array(
                        'ssl' => array(
                            'verify_peer' => false,'verify_peer_name' => false,'allow_self_signed' => true
                        )
                    );
                }

                $mail->setView('contact');
                $mail->setData(
                    array(
                        'email' => $model->email,'message' => $model->body,'name' => $model->firstname.' '.$model->lastname,'description' => 'Customer Contact'
                    )
                );

                
                if ($mail->send()) { }

当我尝试发送电子邮件时,出现此错误消息

stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

我发现建议添加此代码的解决方案(我确实做到了)

if (YII_DEBUG) {
                    $mail->SMTPOptions = array(
                        'ssl' => array(
                            'verify_peer' => false,'allow_self_signed' => true
                        )
                    );
                }

我也在我的php.ini(cacert.pem)中对此进行了更改

[curl]
curl.cainfo="C:\xampp\apache\bin\cacert.pem"

[openssl]

openssl.cafile="C:\xampp\apache\bin\cacert.pem"

我的邮件设置是

'Mailer' => 'smtp','Host' => 'email-smtp.********.amazonaws.com','Port' => 587,'SMTPSecure' => 'tls','SMTPAuth' => true,'Username' => '*************','Password' => '*************',

知道我在做什么错吗?谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...