I want to have more contacts forms in my store and separate transactional emails templates for each contact form in part, for example:

  • contact_form1.phtml with contact_form1.html email template;
  • contact_form2.phtml with contact_form2.html;
  • contact_form3.phtml with contact_form3.html;
  • ....

I need to be like this because I want to have different variable in each email template.

I found this Inchoo tutorial but I don't know how I can add multiple forms and email templates.

Thank you in advance

  • Please let me know whether u are able to submit u r contact form in the frontend? Commented Jul 6, 2017 at 9:08
  • yes the contacts works fine in the frontend but I to add separate transactional emails for each one
    – Robert
    Commented Jul 6, 2017 at 9:29
  • for what is that?
    – Robert
    Commented Jul 6, 2017 at 13:19
  • Sorry @Reobert wrong screenshot. now please check this prntscr.com/fsctjg ? Commented Jul 6, 2017 at 13:23
  • here i am showing you dynamically creating the tabs and in the drop down showing u new templates which were created in the transaction emails prntscr.com/fsddto Commented Jul 6, 2017 at 13:28

1 Answer 1


Step 1: Create a module using Sillk Software Silk Software Module Creator and install the same.

Note: Here i am considering the module called Ewall_EmailTabTamplate

Step 2: Now do the changes in config.xml

<?xml version="1.0"?>
    <!-- Custom Htmls stars Here -->
               <sales_email_order_template translate="label" module="sales">
                <sales_email_order_tab_template translate="label" module="sales">
                <sales_order_email_temp_analyzer translate="label" module="sales">
                <sales_email_order_email_temp_cabmaster translate="label" module="sales">
                <sales_email_order_email_temp_cabvision translate="label" module="sales">
    </template> <!-- adding custom htmls ends here-->


Note: Clear Cache and session after modifying the xml file/s.

Step 3: Create contactForm1.html, contactForm2.html ... in the below path


After html creation has been completed you will be able load the html files in the transaction emails from the admin end.

Login to admin => System => Transactional Emails => Add new template => Click on load template

Screenshot: https://prnt.sc/fsddto

Step 4: Now coming to frontend contact us form in your custom template section

For Example: http://prntscr.com/fsqdri

Please keep the below code in the mentioned path: app/design/frontend/rwd/default/template/emailtabtamplate/index.phtml

<form action="<?php echo $this->getUrl('emailtabtamplate/index/contactForm1'); ?>" id="contactForm1" method="post" 
    <div class="fieldset">
        <h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
        <p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
        <ul class="form-list">
            <li class="fields">
                <div class="field">
                    <label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
                    <div class="input-box">
                        <input name="name" id="name" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Name')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
                <div class="field">
                    <label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
                    <div class="input-box">
                        <input name="email" id="email" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Email')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="email" autocapitalize="off" autocorrect="off" spellcheck="false" />
                <label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
                <div class="input-box">
                    <input name="telephone" id="telephone" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Telephone')) ?>" value="" class="input-text" type="tel" />
            <li class="wide">
                <label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
                <div class="input-box">
                    <textarea name="comment" id="comment" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Comment')) ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
    <div class="buttons-set">
        <input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
        <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Submit')) ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>

<script type="text/javascript">
    //var contactForm = new VarienForm('contactForm1', true);

Step 5: Now keep the below code in the index controller and contactForm1Action app/code/local/Ewall/EmailTabTamplate/controllers/IndexController.php

class Ewall_EmailTabTamplate_IndexController extends Mage_Core_Controller_Front_Action{

    public function IndexAction() {

            $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
      $breadcrumbs->addCrumb("home", array(
                "label" => $this->__("Home Page"),
                "title" => $this->__("Home Page"),
                "link"  => Mage::getBaseUrl()

      $breadcrumbs->addCrumb("titlename", array(
                "label" => $this->__("Titlename"),
                "title" => $this->__("Titlename")



    // contactForm1Action code starts here

    public function contactForm1Action()

         $customerName= $myParams['name'];
         $customerEmail= $myParams['email'];
         $telephone = $myParams['telephone'];
         $comment=  $myParams['comment'];

         $customerName= 'Custom Testing';
         $customerEmail= '[email protected]';
         $telephone = '123456789';
         $comment='Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged';*/

         $myCustomVars = array('customer_name' =>$customerName,
                        'customer_comment' => $comment

       $storeId = Mage::app()->getStore()->getId();
       $recepientName = "Custom Tester";                            
       $templateId = 1; // Template Id from admin end 
       $sender  = array(
                        'name' =>   'Custom Tester',
                        'email' => '[email protected]'
       $recepientEmail = '[email protected]';
       $translate = Mage::getSingleton('core/translate');
       $mail = Mage::getModel('core/email_template');
       $mail->getMail()->addBCC('[email protected]');
       $mail->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $myCustomVars, $storeId);

       $this->_redirect('emailtabtamplate');//redirect url
       Mage::getSingleton('core/session')->addSuccess('Successfully Sent'); 

    // contactForm1Action code ends here

    public function contactForm2Action()
        //Keep the code as shown contactForm1Action


    public function contactForm3Action()
         //Keep the code as shown contactForm1Action 



Step 6: coming to passing custom variables passing to transactional email Please find the screenshot. http://prntscr.com/fsqpln

We have to use the email variables like as shown below in your contactForm.html (or) related transactional email in the Template Content section

{{var customer_name}}
{{var customer_email}}
{{var customer_telephone}}
{{var customer_comment}}

Output: http://prntscr.com/fsqssw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.