Monday, 11 July 2016

how to cutom mail send by load templated

/app/code/local/artis/Testimonial/etc/config.xml

Add this code:-
<global>
        <template>
        <email>
        <contacts_email_configuration_select_template_post translate="label" module="testimonial">
            <label>Custom Email Template After Post Quote Request</label>
            <file>email_template_after_post_request.html</file>
            <type>html</type>
        </contacts_email_configuration_select_template_post >
        </email>
    </template>
    </global>
   
Careted this file on this path:-
app/locale/en_US/template/email/email_template_after_post_request.html

<!--@subject Testimonial submission! @-->

{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}

<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="action-content">
            <h1>Dear Admin,</h1>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Name: {{var name }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Company: {{var company }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Email: {{var email }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Telephone {{var telephone }}</p>
        </td>
    </tr>
        <tr>
        <td class="action-content">
            <p>Wire / Cable Description: {{var description }}</p>
        </td>
    </tr>
            <tr>
        <td class="action-content">
            <p>Length: {{var length }}</p>
        </td>
    </tr>
                <tr>
        <td class="action-content">
            <p>Date Required: {{var drequired }}</p>
        </td>
    </tr>
    <tr>
        <td class="action-content">
            <p>Additional Questions / Comments: {{var acomments}}</p>
        </td>
    </tr>
</table>       

{{template config_path="design/email/footer"}}



/app/code/local/Artis/Contacts/controllers/IndexController.php
==================
 public function quoterequestAction()
    {
        $post = $this->getRequest()->getPost();
        if ( $post ) {
           
            $emailTemplate = Mage::getModel('core/email_template')->loadDefault('contacts_email_configuration_select_template_post');
            $emailTemplateVariables = array();
            $emailTemplateVariables = array();
            $emailTemplateVariables['name'] = $post['name'];
            $emailTemplateVariables['companyname'] = $post['companyname'];
            $emailTemplateVariables['email'] = $post['email'];
            $emailTemplateVariables['telephone'] = $post['telephone'];
            $emailTemplateVariables['description'] = $post['description'];
            $emailTemplateVariables['length'] = $post['length'];
            $emailTemplateVariables['drequired'] = $post['drequired'];
            $emailTemplateVariables['acomments'] = $post['acomments'];
            //print_r($emailTemplateVariables);exit;
           
           
          
            $emailTemplateVariables['customer_email'] = $post['email'];
           
            $emailTemplate->getProcessedTemplate($emailTemplateVariables);
           
            $emailTemplate->setSenderName($post['name']);
            $emailTemplate->setSenderEmail($post['email']);
           
            $recipientName = 'test';
            $recipientEmail = 'artis.test70@gmail.com';
           
            $emailTemplate->send($recipientEmail,$recipientName,$emailTemplateVariables);
        }
    }
==========================

============ Form page:- ==================================
<div class="col-md-9">
<div class="quest-quote-outer">
    <h3>Quote Request</h3>
    <p><strong>Can't find what you are looking for or just want to request a quote?</strong> Fill out the form below or give us a call at (516) 606-6537 or send us an email at <strong><a href="mailto:sales@nassaunationalcable.com">sales@nassaunationalcable.com</a></strong></p>
    <h4>We guarantee same day response!</h4>
    <p>
        Phone: (516) 606-6537</br>E-Fax: (480) 287-9579</br>Fax: (516) 482-6438</br>Email: <a href="mailto:sales@nassaunationalcable.com">sales@nassaunationalcable.com</a>
    </p>
        <form method="post" id="qutote-form" name="qutote-form" class="qutote-form" action="<?php echo Mage::getUrl(); ?>contacts/index/quoterequest/">
        <div class="qutote-form-row1">
            <h3 class="legend">Contact Information</h3>
            <ul class="form-list">
                <li class="fields">
                    <div class="field name">
                        <label  class="required">Name:</label>           
                        <div class="input-box">
                            <input type="text" name="name" id="name" class="input-text required-entry" style="" value="" />                                       
                        </div>
                    </div>
                    <div class="field company">
                        <label for="field_15">Company:</label>               
                        <div class="input-box">
                            <input type="text" name="companyname" id="companyname" class="input-text" style="" value="" />                                                   
                        </div>
                    </div>
                </li>
                <li class="fields">
                    <div class="field email">
                        <label class="required">Email:</label>                   
                        <div class="input-box">
                            <input type="text" name="email" id="email" class="input-text required-entry validate-email" style="" value="" />                   
                        </div>
                    </div>
                    <div class="field webforms-fields-telephone">
                        <label>Telephone:</label>           
                        <div class="input-box">
                            <input type="text" name="telephone" id="telephone" class="input-text" style="" value="" />                                           
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="qutote-form-row2">
            <h3 class="legend">Contact Information</h3>
            <ul class="form-list">
                <li class="wide">
                    <label  class="required">Wire / Cable Description:</label>
                    <div class="input-box">
                        <textarea name="description" id="description" class="input-text required-entry wire-request-details" style=""></textarea>                   
                    </div>
                </li>
                <li class="fields">
                    <div class="field length">
            <label class="required">Length:</label>
            <div class="input-box">
                        <input type="text" name="length" id="length" class="input-text required-entry" style="" value="" />
            </div>
                    </div>
                    <div class="field date-needed">
            <label >Date Required:</label>
            <div class="input-box">
                        <input type="text" name="drequired" id="drequired" class="input-text " style="" value="" />
            </div>
                    </div>
                </li>
                <li class="wide">
            <div class=" webforms-fields-comments">
                        <label>Additional Questions / Comments:</label>           
                        <div class="input-box">
                            <textarea name="acomments" id="acomments" class="input-text" style=""></textarea>               
                        </div>
                    </div>
        </li>
            </ul>
        </div>
        <div class="buttons-set">
            <p class="required">* Required Fields</p>
            <input type="submit" value="submit" class="r-submit">
        </div>
       
    </form>
</div>
</div>




<div class="col-md-3">
<?php echo  $this->getLayout()->createBlock('cms/block')->setBlockId('right-block')->toHtml();?>
</div>


<script type="text/javascript">
//<![CDATA[
    var contactForm = new VarienForm('qutote-form', true);
//]]>
</script>
===========================================

No comments:

Post a Comment