コード例 #1
0
 /**
  * Send email with new account related information
  *
  * @param string $type
  * @param string $backUrl
  * @param string $storeId
  * @return $this
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0')
 {
     if ($this->_scopeConfig->getValue(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DISABLE_CUSTOMER_SUCCESS, 'store', $storeId)) {
         return $this;
     } else {
         return parent::sendNewAccountEmail($type, $backUrl, $storeId);
     }
 }
コード例 #2
0
 public function testSendNewAccountEmailWithoutStoreId()
 {
     $store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $website = $this->getMock('Magento\\Store\\Model\\Website', [], [], '', false);
     $website->expects($this->once())->method('getStoreIds')->will($this->returnValue([1, 2, 3, 4]));
     $this->_storeManager->expects($this->once())->method('getWebsite')->with(1)->will($this->returnValue($website));
     $this->_storeManager->expects($this->once())->method('getStore')->with(1)->will($this->returnValue($store));
     $this->_config->expects($this->exactly(3))->method('getAttribute')->will($this->returnValue($this->_attribute));
     $this->_attribute->expects($this->exactly(3))->method('getIsVisible')->will($this->returnValue(true));
     $methods = ['setTemplateIdentifier', 'setTemplateOptions', 'setTemplateVars', 'setFrom', 'addTo'];
     foreach ($methods as $method) {
         $this->_transportBuilderMock->expects($this->once())->method($method)->will($this->returnSelf());
     }
     $transportMock = $this->getMock('Magento\\Framework\\Mail\\TransportInterface', [], [], '', false);
     $transportMock->expects($this->once())->method('sendMessage')->will($this->returnSelf());
     $this->_transportBuilderMock->expects($this->once())->method('getTransport')->will($this->returnValue($transportMock));
     $this->_model->setData(['website_id' => 1, 'store_id' => 1, 'email' => '*****@*****.**', 'firstname' => 'FirstName', 'lastname' => 'LastName', 'middlename' => 'MiddleName', 'prefix' => 'Prefix']);
     $this->_model->sendNewAccountEmail('registered');
 }
コード例 #3
0
 /**
  * Send either confirmation or welcome email after an account creation
  *
  * @param CustomerModel $customerModel
  * @param Data\Customer $customer
  * @param string        $redirectUrl
  * @return void
  */
 protected function _sendEmailConfirmation(CustomerModel $customerModel, Data\Customer $customer, $redirectUrl)
 {
     try {
         if ($customerModel->isConfirmationRequired()) {
             $customerModel->sendNewAccountEmail(self::NEW_ACCOUNT_EMAIL_CONFIRMATION, $redirectUrl, $customer->getStoreId());
         } else {
             $customerModel->sendNewAccountEmail(self::NEW_ACCOUNT_EMAIL_REGISTERED, $redirectUrl, $customer->getStoreId());
         }
     } catch (MailException $e) {
         // If we are not able to send a new account email, this should be ignored
         $this->logger->logException($e);
     }
 }