Created the form with fields and added the email code for sending the mail.But I need to send the mail with two different bodies
How can I send Please help me.
My Mail code:
<?php
function sendMailAction(){
//Mage::getModel('sales/order')->load(24999);
$cname=$_POST['cname'];
$mobile=$_POST['mobile'];
$html=
'
<p>City: '.$city.'</p>
<p>Location: '.$location.'</p>
<p>Name: '.$cname.'</p>
<p>Email : '.$email.'</p>
<p>Mobile Number: '.$mobile.'</p>'
;
$mail = Mage::getModel('core/email');
$mail->setToName($name);
$mail->setToEmail('some.example@mail.com');
$mail->setBody($html);
$mail->setSubject('Booking');
$mail->setFromEmail('some.example@mail.com');
$mail->setFromName("example");
$mail->setType('html');// YOu can use Html or text as Mail format
try {
$mail->send();
//Mage::getSingleton('core/session')->addSuccess('Your Order is successfully Completed');
//Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl());
return '<h2>Your Order has been submitted. Thank you for using labwise. </h2>';
//$this->_redirect('');
}
catch (Exception $e) {
//Mage::getSingleton('core/session')->addError('Unable to send.');
//Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl());
return '</h2>Unable to submit.</h2>';
//$this->_redirect('');
}
}
function sendMailcustomerAction(){
//Mage::getModel('sales/order')->load(24999);
$email=$_POST['email'];
$city=$_POST['city'];
$location=$_POST['location'];
$cname=$_POST['cname'];
$mobile=$_POST['mobile'];
$html=
''
;
$mail = Mage::getModel('core/email');
$mail->setToName($name);
$mail->setToEmail($email);
$mail->setBody($html);
$mail->setSubject('Booking');
$mail->setFromEmail('Your mail');
$mail->setFromName("somename");
$mail->setType('html');// YOu can use Html or text as Mail format
try {
$mail->send();
//Mage::getSingleton('core/session')->addSuccess('Your Order is successfully Completed');
//Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl());
return 'Your Order is Successfully Completed';
//$this->_redirect('');
}
catch (Exception $e) {
//Mage::getSingleton('core/session')->addError('Unable to send.');
//Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl());
return 'Unable to send.';
//$this->_redirect('');
}
}
echo sendMailcustomerAction();
echo sendMailAction();
?>