function sendemail()
{
// Get the document object.
$document =& JFactory::getDocument();
// Set the MIME type for JSON output.
$document->setMimeEncoding( 'application/json' );
jimport( 'joomla.mail.helper' );
$name = $_POST['name'];
$email = JMailHelper::cleanAddress($_POST['email']);
$comment = JMailHelper::cleanBody($_POST['comment']);
$phone = $_POST['phone'];
$begindate = $_POST['from date'];
$enddate = $_POST['to date'];
$adults = $_POST['num adults'];
$childrens = $_POST['num childrens'];
$subject = $_POST['subject'];
$to = JMailHelper::cleanAddress($_POST['to']);
//print_r($_POST);
#if incorecct email
$return_arr["email_invalid"] = 'true';
}
#if empty fields
elseif($email == '' or $name =='') {
$return_arr["empty"] = 'true';
}
#if empty fields
elseif($_POST['captcha'] != $_POST['recaptcha']) {
$return_arr["captcha"] = 'false';
} else {
$body = JText::_('JE_BFORM_FROM') .$name."<br><br><br> ".JText::_('JE_EMAILFORM_PHONE')." ".$phone." <br><br><br> ".JText::_('JE_EMAILFORM_MESSAGE')." ".$comment." <br><br><br> ".JText::_('JE_EMAILFORM__BEGINDATE')." ".$begindate." <br><br><br> ".JText::_('JE_EMAILFORM__ENDDATE')." ".$enddate." <br><br><br>".JText::_('JE_EMAILFORM_ADULTS')." ".$adults." <br><br><br> ".JText::_('JE_EMAILFORM_CHILDRENS')." ".$childrens;
#if succesfull than send
if (JUtility::sendMail($email, $name, $to, $subject, $body ,$mode = true ) !== true) {
$return_arr["sending_error"] = 'true';
}
}
}
/**
FUNCTION THAT SENDS EMAIL
**/
function tellafriend()
{
// Get the document object.
$document =& JFactory::getDocument();
// Set the MIME type for JSON output.
$document->setMimeEncoding( 'application/json' );
jimport( 'joomla.mail.helper' );
$name = $_POST['name'];
$email = JMailHelper::cleanAddress($_POST['email']);
$comment = JMailHelper::cleanBody($_POST['comment']);
$phone = $_POST['phone'];
$subject = $_POST['subject'];
$begindate = $_POST['from date'];
$enddate = $_POST['to date'];
$adults = $_POST['num adults'];
$childrens = $_POST['num childrens'];
$to = JMailHelper::cleanAddress($_POST['to']);
$id = $_POST['idt'];
$category = $_POST['catid'];
$ad_headline = $_POST['ad_headline'];
//print_r($_POST);
#if incorecct email
$return_arr["email_invalid"] = 'true';
}
#if empty fields
elseif($email == '' or $name =='') {
$return_arr["empty"] = 'true';
}
#if empty fields
elseif($_POST['captcha'] != $_POST['recaptcha']) {
$return_arr["captcha"] = 'false';
} else {
if ($phone) {$ph = "<br>".JText::_('JE_EMAILFORM_PHONE')." ".$phone;}
$uri = JURI::getInstance();
$body = JText::_('JE_BFORM_FROM') ." ".$name."<br>".$ph."
<br><br><br> ".JText::_('JE_EMAILFORM_MESSAGE')." ".$comment."<br /><br /><a href='http://".$uri->getHost().JRoute::_("index.php?option=com_micompo&task=detailed&id=$id&ad_headline=$ad_headline&category=$category")."'><strong>$ad_headline</strong></a>";
En otro archivo modifique esto:
{*CONTACT*}
{if $params->get(contact)}
{if $data->bcont}
<div id="tabs-4" class="detailed_box">
<div class="detailed_box_bar">{JText text='JE_DEATAILED_CONTACT'}</div>
<form id="emailForm" action="">
<table cellpadding="5" cellspacing="0" border="0" width="100%">
<tr>
<td valign="top" class="detailed_box_email" width="50%">
<div style="width: 80%">
<p><label>{JText text="JE_EMAILFORM_FROM"}</label><br /> <input type="text" name="name" id="name" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_EMAIL"}</label><br /> <input type="text" name="email" id="email" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_PHONE"}</label><br /> <input type="text" name="phone" id="phone" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_BEGINDATE"}</label><br /> <input type="text" name="from date" id="begindate" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_ENDDATE"}</label><br /> <input type="text" name="to date" id="enddate" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_ADULTS"}</label><br /> <input type="text" name="num of adults" id="adults" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_CHILDREN"}</label><br /> <input type="text" name="num of children" id="children" style="width: 100%" /></p>
<p><label>{JText text="JE_EMAILFORM_MESSAGE"}</label> <span id="charLeft" class="je_small"> </span><br /><textarea name="comment" id="comment" style="width: 100%" rows="4"></textarea> </p>
</div>
</td>