當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TransportBuilder::addTo方法代碼示例

本文整理匯總了PHP中Magento\Framework\Mail\Template\TransportBuilder::addTo方法的典型用法代碼示例。如果您正苦於以下問題:PHP TransportBuilder::addTo方法的具體用法?PHP TransportBuilder::addTo怎麽用?PHP TransportBuilder::addTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\Mail\Template\TransportBuilder的用法示例。


在下文中一共展示了TransportBuilder::addTo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendCopyTo

 /**
  * Prepare and send copy email message
  *
  * @return void
  */
 public function sendCopyTo()
 {
     $copyTo = $this->identityContainer->getEmailCopyTo();
     if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'copy') {
         foreach ($copyTo as $email) {
             $this->configureEmailTemplate();
             $this->transportBuilder->addTo($email);
             $transport = $this->transportBuilder->getTransport();
             $transport->sendMessage();
         }
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:SenderBuilder.php

示例2: execute

 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;
 }
開發者ID:magewonder,項目名稱:magento2-smtp,代碼行數:15,代碼來源:Test.php

示例3: testAddTo

 /**
  * @covers \Magento\Framework\Mail\Template\TransportBuilder::addTo
  */
 public function testAddTo()
 {
     $this->messageMock->expects($this->once())->method('addTo')->with('to@example.com', 'recipient')->will($this->returnSelf());
     $this->builder->addTo('to@example.com', 'recipient');
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:8,代碼來源:TransportBuilderTest.php


注:本文中的Magento\Framework\Mail\Template\TransportBuilder::addTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。