How to send mail to customer and owner from custom tech support form?
-
12-12-2019 - |
Pregunta
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
Solución
<?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();
}
}
}
Otros consejos
Magento Admin Panel
-> System
-> Configuration
-> SALES
-> Sales Emails
-> Order
-> Send Order Email Copy To
Enter desired email recipients!
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange