0

Using Magento 2 Version 2.1.0 on WAMP Windows 10

As continue with this question Magento 2: SMTP Email gives error "Invalid sender data"

Now this is my code

    $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
    $templateId = $this->scopeConfig->getValue(self::XML_PATH_EMAIL_TEMPLATE);
    $transport = $this->_transportBuilder->setTemplateIdentifier($templateId)
            ->setTemplateOptions(['area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, 'store' => 1])
            ->setTemplateVars(['data' => $postObject])
            ->setFrom($this->scopeConfig->getValue(self::XML_PATH_EMAIL_SENDER, $storeScope))
            ->addTo('xxxxxx@gmail.com')
            ->setReplyTo('xxxxx@gmail.com')
            ->getTransport();
    echo $transport->sendMessage();
    exit;

Now it's giving below error

2 exception(s): Exception #0 (Magento\Framework\Exception\MailException): Could not open socket Exception #1 (Zend_Mail_Protocol_Exception): Could not open socket

I have already followed https://stackoverflow.com/questions/28433816/how-to-fix-could-not-open-socket-in-zend-mail-zend-framework-2

But still same issue. OpenSSL is enabled on WAMP. When i'm trying to uncomment

#LoadModule ssl_module modules/mod_ssl.so

in httpd.conf & trying to restart WAMP Server. It pauses on Yellow not become Green.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.