调magento自定义模板发邮件

1. 设置邮件模板

  <global>

    <template>

      <email>

        <custom_email_template1 module="SampleModule1">

          <label>ActiveCodeline custom email module</label>

          <file>activecodeline_custom_email1.html</file>

          <type>html</type>

        </custom_email_template1>

      </email>

    </template>

  </global>

2. 自定义模板内容  

  <div>     

    <h1>ActiveCodeline custom email example by Branko Ajzele</h1>

    <p>Hi there {{var myvar1}} {{var myvar2}} from {{var myvar3}}. This is just some example template to test custom email module.</p>

  </div>

3.发送邮件

  $templateVars['myvar1']='Branko';

  $templateVars['myvar2']='Ajzele';

  $templateVars['myvar3']='ActiveCodeline';  

 

  $emailTemplate  = Mage::getModel('core/email_template');

  
$emailTemplate->sendTransactional(
  'custom_email_template1',
  array(
  'name'=>'senderName',
  'email'=>'senderEmail'
   ),
  $receiverEmail,
  '251mall',
  $templateVars
  );

 

  

posted on 2014-11-10 15:30  冯亮  阅读(1144)  评论(0编辑  收藏  举报

导航