当前位置: 首页>>代码示例>>PHP>>正文


PHP TransportBuilder::addBcc方法代码示例

本文整理汇总了PHP中Magento\Framework\Mail\Template\TransportBuilder::addBcc方法的典型用法代码示例。如果您正苦于以下问题:PHP TransportBuilder::addBcc方法的具体用法?PHP TransportBuilder::addBcc怎么用?PHP TransportBuilder::addBcc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Mail\Template\TransportBuilder的用法示例。


在下文中一共展示了TransportBuilder::addBcc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 /**
  * Prepare and send email message
  *
  * @return void
  */
 public function send()
 {
     $this->configureEmailTemplate();
     $this->transportBuilder->addTo($this->identityContainer->getCustomerEmail(), $this->identityContainer->getCustomerName());
     $copyTo = $this->identityContainer->getEmailCopyTo();
     if (!empty($copyTo) && $this->identityContainer->getCopyMethod() == 'bcc') {
         foreach ($copyTo as $email) {
             $this->transportBuilder->addBcc($email);
         }
     }
     $transport = $this->transportBuilder->getTransport();
     $transport->sendMessage();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:SenderBuilder.php

示例2: testAddBcc

 /**
  * @covers \Magento\Framework\Mail\Template\TransportBuilder::addBcc
  */
 public function testAddBcc()
 {
     $this->messageMock->expects($this->once())->method('addBcc')->with('bcc@example.com')->will($this->returnSelf());
     $this->builder->addBcc('bcc@example.com');
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:8,代码来源:TransportBuilderTest.php

示例3: sendOrderUpdateEmail

 /**
  * Send email with order update information
  *
  * @param boolean $notifyCustomer
  * @param string $comment
  * @return $this
  */
 public function sendOrderUpdateEmail($notifyCustomer = true, $comment = '')
 {
     $storeId = $this->getStore()->getId();
     if (!$this->_salesData->canSendOrderCommentEmail($storeId)) {
         return $this;
     }
     // Get the destination email addresses to send copies to
     $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO);
     $copyMethod = $this->_scopeConfig->getValue(self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
     // Check if at least one recipient is found
     if (!$notifyCustomer && !$copyTo) {
         return $this;
     }
     // Retrieve corresponding email template id and customer name
     if ($this->getCustomerIsGuest()) {
         $templateId = $this->_scopeConfig->getValue(self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
         $customerName = $this->getBillingAddress()->getName();
     } else {
         $templateId = $this->_scopeConfig->getValue(self::XML_PATH_UPDATE_EMAIL_TEMPLATE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
         $customerName = $this->getCustomerName();
     }
     if ($notifyCustomer) {
         $this->_transportBuilder->setTemplateIdentifier($templateId)->setTemplateOptions(array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId))->setTemplateVars(array('order' => $this, 'comment' => $comment, 'billing' => $this->getBillingAddress(), 'store' => $this->getStore()))->setFrom($this->_scopeConfig->getValue(self::XML_PATH_UPDATE_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->addTo($this->getCustomerEmail(), $customerName);
         if ($copyTo && $copyMethod == 'bcc') {
             // Add bcc to customer email
             foreach ($copyTo as $email) {
                 $this->_transportBuilder->addBcc($email);
             }
         }
         /** @var \Magento\Framework\Mail\TransportInterface $transport */
         $transport = $this->_transportBuilder->getTransport();
         $transport->sendMessage();
     }
     // Email copies are sent as separated emails if their copy method is
     // 'copy' or a customer should not be notified
     if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
         foreach ($copyTo as $email) {
             $this->_transportBuilder->setTemplateIdentifier($templateId)->setTemplateOptions(array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $storeId))->setTemplateVars(array('order' => $this, 'comment' => $comment, 'billing' => $this->getBillingAddress(), 'store' => $this->getStore()))->setFrom($this->_scopeConfig->getValue(self::XML_PATH_UPDATE_EMAIL_IDENTITY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId))->addTo($email)->getTransport()->sendMessage();
         }
     }
     return $this;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:49,代码来源:Order.php


注:本文中的Magento\Framework\Mail\Template\TransportBuilder::addBcc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。