Using Magento 2 Version 2.1.0 on WAMP Windows 10
I'm using https://github.com/magepal/magento2-gmailsmtpapp
In magento Admin, then goto Stores -> Configuration -> Advanced -> System -> Gmail/Google Apps SMTP Pro. I have configured things
- Authentication method: LOGIN
- SSL type: SSL (Gmail / Google Apps)
- SMTP Host: smtp.gmail.com
- Username: Gmail Account Username
- Password: GmailAccount Password
- Set Reply-to: Yes
- Set Return-Path: Yes
I have below code in my Controller
$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
$transport = $this->_transportBuilder->setTemplateIdentifier(1)
->setTemplateOptions(['area' => \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, 'store' => 1])
->setTemplateVars(['data' => $postObject])
->setFrom('[email protected]', $storeScope)
->addTo('[email protected]', $storeScope)
->setReplyTo('[email protected]')
->getTransport();
echo $transport->sendMessage();
When i run this code, it gives below error
1 exception(s): Exception #0 (Magento\Framework\Exception\MailException): Invalid sender data
Now it's causing
Could Not Open Socket