0

How to send mail to customer and owner from custom tech support form ?

my Template Content is

Name: {{var data.name}}
E-mail: {{var data.email}}
Day: {{var data.day}}
Telephone: {{var data.telephone}}
Message: {{var data.message}}

i want to use this template and send mail to customer and owner

name cof template is support

2
  • Do you want this mail to be sent to both customer and store owner? Commented Dec 26, 2014 at 7:01
  • Yes................. Commented Dec 26, 2014 at 7:12

2 Answers 2

3
<?php
class Brain_Support_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
    $this->loadLayout();     
    $this->renderLayout();
}

public function submitAction()
{
  $data=$this->getRequest()->getPost();
  $name=$data['name'];
  $cemail=$data['email'];
  $number=$data['number'];
  $message=$data['message'];
    $emailTemplate = Mage::getModel('core/email_template')
        ->loadDefault('recurring_order_email_template');
  $emailTemplate2 = Mage::getModel('core/email_template')
        ->loadDefault('support_thanks_template');

$emailTemplateVariables = array();
$emailTemplateVariables['var1'] = $name;
$emailTemplateVariables['var2'] = $cemail;
$emailTemplateVariables['var3'] = $number;
$emailTemplateVariables['var4'] = $message;
$email=Mage::getStoreConfig('support_options/support_data/support_email');
$name=Mage::getStoreConfig('support_options/support_data/support_name');
$emailTemplateVariables['myname'] = $name;
$emailTemplate->getProcessedTemplate($emailTemplateVariables);
$emailTemplate->setSenderName($name); 
$emailTemplate->setSenderEmail($email);
$emailTemplate2->getProcessedTemplate($emailTemplateVariables);
$emailTemplate2->setSenderName($name); 
$emailTemplate2->setSenderEmail($email);
try {

$emailTemplate->send($email, 'vaibbhav', $emailTemplateVariables);
$emailTemplate2->send($cemail, 'vaibbhav', $emailTemplateVariables);
$this->_redirect('/');
} catch (Exception $e) {
    echo $e->getMessage();
} 
}
}
0

Magento Admin Panel -> System -> Configuration -> SALES -> Sales Emails -> Order -> Send Order Email Copy To

Enter desired email recipients!

2

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.