zoukankan      html  css  js  c++  java
  • 剖析magento中关于Email模板的设置

    public function send()
        {
            $emailTemplate = Mage::getModel('core/email_template');
            // Send all emails from corresponding list
            while (!empty($this->_emailInfos)) {
                $emailInfo = array_pop($this->_emailInfos);
                // Handle "Bcc" recepients of the current email
                $emailTemplate->addBcc($emailInfo->getBccEmails());
                // Set required design parameters and delegate email sending to Mage_Core_Model_Email_Template
                $emailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => $this->getStoreId()))
                    ->sendTransactional(
                    $this->getTemplateId(),
                    $this->getSender(),
                    $emailInfo->getToEmails(),
                    $emailInfo->getToNames(),
                    $this->getTemplateParams(),
                    $this->getStoreId()
                );
            }
            return $this;
        }

      (1) $this->getTemplateId()

      <global>

        <template>
                 <email>
                      <customer_create_account_email_template translate="label" module="customer">
                          <label>New account</label>
                              <file>account_new.html</file>
                              <type>html</type>

                      </customer_create_account_email_template>

          </email>

        <template>

    </global>

      $this->getTemplateId()表示上述配置中的customer_create_account_email_template

      (2) $this->getStoreId()

        系统会根据$this->getStoreId()的值调用locale下的不同邮件模板。默认调用app/locale/en_US/template/email下的邮件模板

      (3) $this->getTemplateParams()

        邮件模板中的变量都来源于此

    作者:冯亮
             
    能力有限,水平一般。如有错误,欢迎指正
  • 相关阅读:
    1. 初探--prometheus调研
    Spring boot采坑记--- 在启动时RequstMappingHandlerMapping无法找到部分contorller类文件的解决方案
    Servlet——映射细节、3.0注解配置、线程不安全问题
    Servlet——概述、实现方式、生命周期、ServletConfig类
    HTTP——概述、请求和响应、GET和POST请求
    Tomcat——简介、目录结构等
    XML解析——Dom4j解析器
    XML解析——Jsoup解析器
    XML解析——Jaxp解析器
    XML——简介、语法、约束、解析
  • 原文地址:https://www.cnblogs.com/fengliang/p/3922898.html
Copyright © 2011-2022 走看看