I use Mageplaza SMTP extension to setup the SMTP. When testing the connection, it popped up the follow error. I have already tried some solution online, like trying to modify abstract.php file. There is also an answer saying it maybe caused by shared host, since I am also hosting the website in shared host. But I contacted bluehost, they said my MX is pointing to Google. They won't block anything. Any ideas on this issue? php version: 7.1 Magento 2 version: 2.3.2
HELP! Magento 2 SMTP setup Could not open socket: stream_socket_client(): Peer certificate not match
4 Answers
You need to try this.
open this file : vendor\magento\zendframework1\library\Zend\Mail\Protocol\Abstract.php
arround line no 267.
$this->_socket = @stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION);
comment above line and add this code below that line.
$stream_context = stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
));
$this->_socket = stream_socket_client(
$remote,
$errorNum,
$errorStr,
self::TIMEOUT_CONNECTION,
STREAM_CLIENT_CONNECT,
$stream_context
);
-
thank you for the reply. But it is still not working. Do you think it is because of the php version? I am using php 7.1– lancwlCommented Sep 8, 2019 at 2:46
The issue is fixed by changing the SMTP host to bluehost (host provider). Looks like the site is not using the gmail host which is weird.
Use Magepal Extension & ask me if it is not working.