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"?>
<config>
<modules>
<Ewall_EmailTabTamplate>
<version>0.1.0</version>
</Ewall_EmailTabTamplate>
</modules>
<frontend>
<routers>
<emailtabtamplate>
<use>standard</use>
<args>
<module>Ewall_EmailTabTamplate</module>
<frontName>emailtabtamplate</frontName>
</args>
</emailtabtamplate>
</routers>
<layout>
<updates>
<emailtabtamplate>
<file>emailtabtamplate.xml</file>
</emailtabtamplate>
</updates>
</layout>
</frontend>
<global>
<helpers>
<emailtabtamplate>
<class>Ewall_EmailTabTamplate_Helper</class>
</emailtabtamplate>
</helpers>
<blocks>
<emailtabtamplate>
<class>Ewall_EmailTabTamplate_Block</class>
</emailtabtamplate>
</blocks>
<!-- Custom Htmls stars Here -->
<template>
<email>
<sales_email_order_template translate="label" module="sales">
<label>ContactForm-1</label>
<file>sales/contactForm1.html</file>
<type>html</type>
</sales_email_order_template>
<sales_email_order_tab_template translate="label" module="sales">
<label>ContactForm-2</label>
<file>sales/contactForm2.html</file>
<type>html</type>
</sales_email_order_tab_template>
<sales_order_email_temp_analyzer translate="label" module="sales">
<label>ContactForm-3</label>
<file>sales/contactForm3.html</file>
<type>html</type>
</sales_order_email_temp_analyzer>
<sales_email_order_email_temp_cabmaster translate="label" module="sales">
<label>ContactForm-4</label>
<file>sales/contactForm4.html</file>
<type>html</type>
</sales_email_order_email_temp_cabmaster>
<sales_email_order_email_temp_cabvision translate="label" module="sales">
<label>ContactForm-5</label>
<file>sales/contactForm5.html</file>
<type>html</type>
</sales_email_order_email_temp_cabvision>
</email>
</template> <!-- adding custom htmls ends here-->
</global>
</config>
Note: Clear Cache and session after modifying the xml file/s.
Step 3: Create contactForm1.html, contactForm2.html ... in the below path
app/locale/en_US/template/email/sales/contactForm1.html
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"
class="scaffold-form">
<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>
</div>
<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" />
</div>
</div>
</li>
<li>
<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" />
</div>
</li>
<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>
</li>
</ul>
</div>
<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>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
//var contactForm = new VarienForm('contactForm1', true);
//]]>
</script>
Step 5: Now keep the below code in the index controller and contactForm1Action
app/code/local/Ewall/EmailTabTamplate/controllers/IndexController.php
<?php
class Ewall_EmailTabTamplate_IndexController extends Mage_Core_Controller_Front_Action{
public function IndexAction() {
$this->loadLayout();
$this->getLayout()->getBlock("head")->setTitle($this->__("Titlename"));
$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")
));
$this->renderLayout();
}
// contactForm1Action code starts here
public function contactForm1Action()
{
$myParams=$this->getRequest()->getParams();
$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_email'=>$customerEmail,
'customer_telephone'=>$telephone,
'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);
$translate->setTranslateInline(true);
$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