stream_socket_enable_crypto():对等证书CN =`cs723.mojohost.com'与预期的CN ='smtp.sendgrid.net'不匹配 [英] stream_socket_enable_crypto(): Peer certificate CN=`cs723.mojohost.com' did not match expected CN=`smtp.sendgrid.net'
问题描述
我们正尝试向新成员发送自动回复电子邮件。我们正在同一台服务器上的其他站点上使用相同的配置,这没有问题。发送电子邮件后,将返回以下错误:
We are attempting to send an autoresponder email to new members. We're using the same configuration on other sites on the same server with no issue. Upon sending the email the following error is returned:
stream_socket_enable_crypto():对等证书CN =
cs723.mojohost。 com
与预期的CN =smtp.sendgrid.net
stream_socket_enable_crypto(): Peer certificate CN=
cs723.mojohost.com
did not match expected CN=smtp.sendgrid.net
https://gyazo.com/ffb0cb7645d51ed21ecc863f1e3196b2
我们正在使用Laravel连接到:
smtp.sendgrid.net
端口-587
使用TLS的加密
We're using Laravel with connecting to: smtp.sendgrid.net port - 587 encription using TLS
我们尝试以下操作均未成功:
We have tried the following with no success:
- 端口选项25& 2525(返回其他错误 https://gyazo.com/3d42107c6aa66acc2fbe582b3a6a352e )
- 将Laravel重新配置为在
MAIL FROM
命令之前发送AUTH
命令(返回相同的错误250)
- port options 25 & 2525 (returns a different error https://gyazo.com/3d42107c6aa66acc2fbe582b3a6a352e)
- reconfigured Laravel to send
AUTH
command beforeMAIL FROM
command (returns same different error 250)
此外,我们无法通过PUTTY连接。我们验证了MojoHost的SSH权限是正确的。
Additionally we are unable to connect via PUTTY. We verified the SSH permissions are correct with MojoHost.
我在另一篇文章中读到
正确的解决方法是用一个好的证书替换无效,配置错误或自签名的证书。
The correct fix for this is to replace the invalid, misconfigured or self-signed certificate with a good one.
尝试也没有成功。希望有人可以提供一些有用的见解。 ...
Attempted that with no success either. Hoping someone can provide some helpful insight. Going on a week now of trying to solve this....
谢谢,
Mike
Thanks, Mike
推荐答案
从
\vendor\laravel\framework\src的createSmtpDriver方法中luminaIlluminate\Mail\TransportManager.php
\vendor\laravel\framework\src\Illuminate\Mail\TransportManager.php
它从
\config\mail.php
\config\mail.php
后来被用作自定义选项
供应商\swiftmailer\swiftmailer\lib\classes\Swift\Transport\内的stream_context_create方法StreamBuffer.php。
\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php.
因此要设置密钥verify_peer,verify_peer_name和allow_self_signed以解决OP提到的错误,您可以添加以下是\config\mail.php:
So to set the keys verify_peer, verify_peer_name, and allow_self_signed to solve the error mentioned by the OP you can add the following to the \config\mail.php:
'stream' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
],
这篇关于stream_socket_enable_crypto():对等证书CN =`cs723.mojohost.com'与预期的CN ='smtp.sendgrid.net'不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!