gpt4 book ai didi

php - 如何处理 Laravel 的 SMTP 驱动程序中的自签名 TLS 证书?

转载 作者:可可西里 更新时间:2023-11-01 12:24:18 26 4
gpt4 key购买 nike

我正在尝试使用此配置发送电子邮件:

return [

'driver' => 'smtp',

'host' => 'mail.mydomain.com',

'port' => 26,

'from' => ['address' => 'mailer@mydomain.com', 'name' => 'Mailer'],

'encryption' => 'tls',

'username' => env('MAIL_USERNAME'),

'password' => env('MAIL_PASSWORD'),

'sendmail' => '/usr/sbin/sendmail -bs',

'pretend' => false,

];

当我提交表单时收到此错误:

ErrorException in StreamBuffer.php line 95:
stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

我找到了这个解决方案,人们似乎已经用同一个库解决了这个问题,但我无法在 Laravel 中解决它。

https://github.com/PHPMailer/PHPMailer/issues/368

最佳答案

Editor's note: disabling SSL verification has security implications. Without verification of the authenticity of SSL/HTTPS connections, a malicious attacker can impersonate a trusted endpoint (such as GitHub or some other remote Git host), and you'll be vulnerable to a Man-in-the-Middle Attack.

Be sure you fully understand the security issues before using this as a solution.

在你的 config/mail.php 底部添加这个

'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],

这将解决您的问题。

关于php - 如何处理 Laravel 的 SMTP 驱动程序中的自签名 TLS 证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30714229/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com