本文整理汇总了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();
}
}
}
示例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;
}
示例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');
}