【问题标题】:How to use the Email template in Magento如何在 Magento 中使用电子邮件模板
【发布时间】:2023-03-31 17:36:01
【问题描述】:

我在 magento 社区版 1.5.0.1 中开发我的商店。我需要一个电子邮件模板,内容可由管理员编辑。我通过管理员“交易电子邮件”创建了一个电子邮件模板。现在我需要从我的自定义模块访问和使用该电子邮件。我怎么得到它?,你有什么想法让我知道。

【问题讨论】:

    标签: magento magento-1.5 email-templates


    【解决方案1】:

    应该这样做。

    public function sendTransactionalEmail() {
    
            // Transactional Email Template's ID
            $templateId = 1;
    
            // Set sender information
            $senderName = Mage::getStoreConfig('trans_email/ident_support/name');
            $senderEmail = Mage::getStoreConfig('trans_email/ident_support/email');
            $sender = array('name' => $senderName,
                        'email' => $senderEmail);
    
            // Set recepient information
            $recepientEmail = 'john@example.com';
            $recepientName = 'John Doe';        
    
            // Get Store ID
            $storeId = Mage::app()->getStore()->getId();
    
            // Set variables that can be used in email template
            $vars = array('customerName' => 'customer@example.com',
                      'customerEmail' => 'Mr. Nil Cust');
    
            $translate  = Mage::getSingleton('core/translate');
    
            // Send Transactional Email
            Mage::getModel('core/email_template')
                ->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
    
            $translate->setTranslateInline(true);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多