示例#1
0
 public function __construct(\MageWonder\Smtp\Helper\Data $helper)
 {
     $this->_apiKey = $helper->getApiKey();
     $this->_provider = $helper->getProvider();
     if ($this->_provider == Provider::PROVIDER_SENDGRID) {
         if (!empty($this->_apiKey)) {
             $this->_api = new \SendGrid($this->_apiKey);
         }
     }
 }
示例#2
0
 public function execute()
 {
     $email = $this->getRequest()->getParam('email');
     $this->_transportBuilder->setTemplateIdentifier(self::EMAIL_TEMPLATE_TEST_ID);
     $this->_transportBuilder->setFrom($this->_helper->getTestSender());
     $this->_transportBuilder->addTo($email);
     $this->_transportBuilder->setTemplateVars([]);
     $this->_transportBuilder->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 1]);
     $transport = $this->_transportBuilder->getTransport();
     $transport->sendMessage();
     /** @var \Magento\Framework\Controller\Result\Json $resultJson */
     $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
     $resultJson->setData(['error' => 0]);
     return $resultJson;
 }