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(): Peer certificate CN=
cs723.mojohost.com
did not match expected CN=smtp.sendgrid.net
https://gyazo.com/ffb0cb7645d51ed21ecc863f1e3196b2
We're using Laravel with connecting to: smtp.sendgrid.net port - 587 encription using TLS
We have tried the following with no success:
AUTH
command before MAIL FROM
command (returns same different error 250)Additionally we are unable to connect via PUTTY. We verified the SSH permissions are correct with MojoHost.
I've read in a different post that
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....
Thanks, Mike
In the method createSmtpDriver from
\vendor\laravel\framework\src\Illuminate\Mail\TransportManager.php
it fetches the key stream from
\config\mail.php
that is later used as custom options for the stream_context_create method inside
\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.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,
],
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With