Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/07/2012, 12:42
juanjesuss
 
Fecha de Ingreso: julio-2012
Ubicación: andalucia
Mensajes: 4
Antigüedad: 11 años, 9 meses
Puntos: 0
mail ¿que he hecho mal?

He modificado para que el mail lleve mas campos , lo unico claro es que solo hay que cambiar un par de archivos, pero me da error, lo he revisado varias veces y no encuentro el problema.

Aqui os pongo los trozos de lo que he modificado.


Código PHP:
Ver original
  1. function sendemail()
  2. {
  3.  
  4. // Get the document object.
  5. $document =& JFactory::getDocument();
  6. // Set the MIME type for JSON output.
  7. $document->setMimeEncoding( 'application/json' );
  8.  
  9. jimport( 'joomla.mail.helper' );
  10.  
  11. $name   = $_POST['name'];
  12. $email = JMailHelper::cleanAddress($_POST['email']);
  13. $comment = JMailHelper::cleanBody($_POST['comment']);
  14. $phone  = $_POST['phone'];
  15. $begindate = $_POST['from date'];
  16. $enddate    = $_POST['to date'];
  17. $adults = $_POST['num adults'];
  18. $childrens  = $_POST['num childrens'];
  19. $subject    = $_POST['subject'];
  20. $to = JMailHelper::cleanAddress($_POST['to']);
  21.  
  22. $return_arr = array();
  23.  
  24. //print_r($_POST);
  25.  
  26. #if incorecct email
  27. if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
  28. $return_arr["email_invalid"] = 'true';
  29. }
  30. #if empty fields
  31. elseif($email == '' or $name =='') {
  32. $return_arr["empty"] = 'true';
  33. }
  34. #if empty fields
  35. elseif($_POST['captcha'] != $_POST['recaptcha']) {
  36. $return_arr["captcha"] = 'false';
  37. } else {
  38.  
  39. $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;
  40.  
  41.  
  42.  
  43. #if succesfull than send
  44. if (JUtility::sendMail($email, $name, $to, $subject, $body ,$mode = true ) !== true) {
  45.  
  46. $return_arr["sending_error"] = 'true';
  47.  
  48. }
  49.  
  50. }
  51.  
  52. echo json_encode($return_arr);
  53. exit();
  54.  
  55. }
  56.  
  57.  
  58.  
  59. /**
  60. FUNCTION THAT SENDS EMAIL
  61. **/
  62. function tellafriend()
  63. {
  64.  
  65. // Get the document object.
  66. $document =& JFactory::getDocument();
  67. // Set the MIME type for JSON output.
  68. $document->setMimeEncoding( 'application/json' );
  69.  
  70. jimport( 'joomla.mail.helper' );
  71.  
  72. $name   = $_POST['name'];
  73. $email = JMailHelper::cleanAddress($_POST['email']);
  74. $comment = JMailHelper::cleanBody($_POST['comment']);
  75. $phone  = $_POST['phone'];
  76. $subject    = $_POST['subject'];
  77. $begindate = $_POST['from date'];
  78. $enddate    = $_POST['to date'];
  79. $adults = $_POST['num adults'];
  80. $childrens  = $_POST['num childrens'];
  81. $to = JMailHelper::cleanAddress($_POST['to']);
  82. $id = $_POST['idt'];
  83. $category   = $_POST['catid'];
  84. $ad_headline = $_POST['ad_headline'];
  85.  
  86. $return_arr = array();
  87.  
  88. //print_r($_POST);
  89.  
  90. #if incorecct email
  91. if(!filter_var($email, FILTER_VALIDATE_EMAIL) || !filter_var($to, FILTER_VALIDATE_EMAIL) ) {
  92. $return_arr["email_invalid"] = 'true';
  93. }
  94. #if empty fields
  95. elseif($email == '' or $name =='') {
  96. $return_arr["empty"] = 'true';
  97. }
  98. #if empty fields
  99. elseif($_POST['captcha'] != $_POST['recaptcha']) {
  100. $return_arr["captcha"] = 'false';
  101. } else {
  102. if ($phone) {$ph = "<br>".JText::_('JE_EMAILFORM_PHONE')." ".$phone;}
  103. $uri = JURI::getInstance();
  104. $body = JText::_('JE_BFORM_FROM') ." ".$name."<br>".$ph."
  105. <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>";
  106.  
  107.  
  108. En otro archivo modifique esto:
  109. {*CONTACT*}
  110. {if $params->get(contact)}
  111. {if $data->bcont}
  112. <div id="tabs-4" class="detailed_box">
  113. <div class="detailed_box_bar">{JText text='JE_DEATAILED_CONTACT'}</div>
  114. <form id="emailForm" action="">
  115. <table cellpadding="5" cellspacing="0" border="0" width="100%">
  116. <tr>
  117. <td valign="top" class="detailed_box_email" width="50%">
  118. <div style="width: 80%">
  119. <p><label>{JText text="JE_EMAILFORM_FROM"}</label><br /> <input type="text" name="name" id="name" style="width: 100%" /></p>
  120. <p><label>{JText text="JE_EMAILFORM_EMAIL"}</label><br /> <input type="text" name="email" id="email" style="width: 100%" /></p>
  121. <p><label>{JText text="JE_EMAILFORM_PHONE"}</label><br /> <input type="text" name="phone" id="phone" style="width: 100%" /></p>
  122. <p><label>{JText text="JE_EMAILFORM_BEGINDATE"}</label><br /> <input type="text" name="from date" id="begindate" style="width: 100%" /></p>
  123. <p><label>{JText text="JE_EMAILFORM_ENDDATE"}</label><br /> <input type="text" name="to date" id="enddate" style="width: 100%" /></p>
  124. <p><label>{JText text="JE_EMAILFORM_ADULTS"}</label><br /> <input type="text" name="num of adults" id="adults" style="width: 100%" /></p>
  125. <p><label>{JText text="JE_EMAILFORM_CHILDREN"}</label><br /> <input type="text" name="num of children" id="children" style="width: 100%" /></p>
  126. <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>   
  127. </div>
  128. </td>